Skip to content

[#2641] Fix sluggish console movement on dragging, in mobile view of browser window #2754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 24 additions & 16 deletions client/modules/IDE/components/PreviewFrame.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Frame = styled.iframe`
border-width: 0;
`;

function PreviewFrame({ fullView }) {
function PreviewFrame({ fullView, isOverlayVisible }) {
const iframe = useRef();
const previewUrl = getConfig('PREVIEW_URL');
useEffect(() => {
Expand All @@ -28,28 +28,36 @@ function PreviewFrame({ fullView }) {
hid; microphone; magnetometer; midi; payment; usb; serial; vr; xr-spatial-tracking`;

return (
<Frame
title="sketch preview"
src={frameUrl}
sandbox={sandboxAttributes}
allow={allow}
scrolling="auto"
allowtransparency
allowpaymentrequest
allowFullScreen
frameBorder="0"
ref={iframe}
fullView={fullView}
/>
<>
<div
className="preview-frame-overlay"
style={{ display: isOverlayVisible ? 'block' : 'none' }}
/>
<Frame
title="sketch preview"
src={frameUrl}
sandbox={sandboxAttributes}
allow={allow}
scrolling="auto"
allowtransparency
allowpaymentrequest
allowFullScreen
frameBorder="0"
ref={iframe}
fullView={fullView}
/>
</>
);
}

PreviewFrame.propTypes = {
fullView: PropTypes.bool
fullView: PropTypes.bool,
isOverlayVisible: PropTypes.bool
};

PreviewFrame.defaultProps = {
fullView: false
fullView: false,
isOverlayVisible: false
};

export default PreviewFrame;
23 changes: 13 additions & 10 deletions client/modules/IDE/pages/IDEView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ const IDEView = () => {
primary="second"
size={ide.consoleIsExpanded ? consoleSize : 29}
minSize={29}
onChange={(size) => setConsoleSize(size)}
onChange={(size) => {
setConsoleSize(size);
}}
allowResize={ide.consoleIsExpanded}
className="editor-preview-subpanel"
>
Expand All @@ -191,16 +193,10 @@ const IDEView = () => {
</h2>
</header>
<div className="preview-frame__content">
<div
className="preview-frame-overlay"
style={{ display: isOverlayVisible ? 'block' : 'none' }}
<PreviewFrame
cmController={cmRef.current}
isOverlayVisible={isOverlayVisible}
/>
<div>
{((preferences.textOutput || preferences.gridOutput) &&
ide.isPlaying) ||
ide.isAccessibleOutputPlaying}
</div>
<PreviewFrame cmController={cmRef.current} />
</div>
</section>
</SplitPane>
Expand All @@ -215,11 +211,18 @@ const IDEView = () => {
split="horizontal"
primary="second"
minSize={200}
onChange={() => {
setIsOverlayVisible(true);
}}
onDragFinished={() => {
setIsOverlayVisible(false);
}}
>
<PreviewFrame
fullView
hide={!ide.isPlaying}
cmController={cmRef.current}
isOverlayVisible={isOverlayVisible}
/>
<Console />
</SplitPane>
Expand Down