From 6fe4025a58fdb80faf2fe9605b43a9857387a913 Mon Sep 17 00:00:00 2001 From: Siklos Date: Mon, 8 Aug 2022 11:31:33 +0200 Subject: [PATCH] Fix svg viewer position --- src/Components/Bar/Bar.tsx | 2 ++ src/Components/SVG/SVG.tsx | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Components/Bar/Bar.tsx b/src/Components/Bar/Bar.tsx index 672f80f..1738a3f 100644 --- a/src/Components/Bar/Bar.tsx +++ b/src/Components/Bar/Bar.tsx @@ -11,6 +11,8 @@ interface IBarProps { ToggleTimeline: () => void } +export const BAR_WIDTH = 64; // 4rem + export const Bar: React.FC = (props) => { return (
diff --git a/src/Components/SVG/SVG.tsx b/src/Components/SVG/SVG.tsx index 9ebe3af..a2e0e20 100644 --- a/src/Components/SVG/SVG.tsx +++ b/src/Components/SVG/SVG.tsx @@ -3,6 +3,7 @@ import { UncontrolledReactSVGPanZoom } from 'react-svg-pan-zoom'; import { Container } from './Elements/Container'; import { ContainerModel } from '../../Interfaces/ContainerModel'; import { Selector } from './Elements/Selector'; +import { BAR_WIDTH } from '../Bar/Bar'; interface ISVGProps { width: number @@ -12,8 +13,8 @@ interface ISVGProps { } interface ISVGState { - viewerWidth: number, - viewerHeight: number, + viewerWidth: number + viewerHeight: number } export class SVG extends React.PureComponent { @@ -23,14 +24,14 @@ export class SVG extends React.PureComponent { constructor(props: ISVGProps) { super(props); this.state = { - viewerWidth: window.innerWidth, + viewerWidth: window.innerWidth - BAR_WIDTH, viewerHeight: window.innerHeight }; } resizeViewBox(): void { this.setState({ - viewerWidth: window.innerWidth, + viewerWidth: window.innerWidth - BAR_WIDTH, viewerHeight: window.innerHeight }); } @@ -60,7 +61,7 @@ export class SVG extends React.PureComponent { } return ( -
+
{ miniatureProps={{ position: 'left', background: '#616264', - width: window.innerWidth - 12, + width: window.innerWidth - 12 - BAR_WIDTH, height: 120 }} >