Skip to content

Commit 017db43

Browse files
committed
fix: editor zoom device centering
1 parent 601f1a0 commit 017db43

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/editor-v2/containers/MiddleScreen/MiddleScreen.scss

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,23 @@ $block: '.#{$ns}middle-screen';
2424
width: 100%;
2525
height: 100%;
2626
margin: auto;
27+
display: flex;
28+
justify-content: center;
29+
align-items: flex-start;
30+
overflow: hidden;
2731
}
2832

2933
&__canvas {
30-
transform-origin: left top;
34+
transform-origin: center top;
3135
overflow-y: scroll;
3236
position: relative;
3337
height: 100%;
38+
max-width: 100%;
39+
}
40+
41+
&__iframe {
42+
display: block;
43+
margin: 0 auto;
3444
}
3545

3646
&__overlay {

src/editor-v2/containers/MiddleScreen/MiddleScreen.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,23 @@ const MiddleScreen = ({className, CustomTop}: MiddleScreenProps) => {
4545
</div>
4646
) : null}
4747
<div className={b('content')}>
48-
<div className={b('wrapper')} style={{width: deviceWidth}}>
48+
<div className={b('wrapper')}>
4949
<div
5050
ref={setCanvasRef}
5151
className={b('canvas', {hidden: !initialized})}
5252
style={{
5353
transform: `scale(${zoom}%)`,
5454
height: `${(100 / zoom) * 100}%`,
55-
width: `${(100 / zoom) * 100}%`,
55+
width: deviceWidth,
56+
maxWidth: `${(100 / zoom) * 100}%`,
5657
}}
5758
>
5859
<iframe
5960
ref={(instance) => instance && setIframeElement(instance)}
6061
className={b('iframe')}
6162
src={url}
6263
height={`${height}px`}
63-
width="100%"
64+
width={deviceWidth}
6465
frameBorder="0"
6566
title="Page Constructor Iframe"
6667
/>

0 commit comments

Comments
 (0)