Skip to content

Commit a3d933b

Browse files
hide global scroll bars with css, make rect sorting actually work by changing to minus instead of comparator
1 parent c9eedd0 commit a3d933b

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/components/CodePreview.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React, { Component, Fragment } from 'react';
2+
import { withStyles } from '@material-ui/core/styles';
3+
import { format } from 'prettier';
4+
import componentRender from '../utils/componentRender.util';
5+
6+
class CodePreview extends Component {
7+
render(): JSX.Element {
8+
const { focusComponent, components } = this.props;
9+
return (
10+
<div>
11+
{/* <p> */}
12+
<pre>{format(componentRender(focusComponent, components))}</pre>
13+
{/* </p> */}
14+
</div>
15+
);
16+
}
17+
}
18+
19+
export default CodePreview;

src/components/KonvaStage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class KonvaStage extends Component {
196196
imageSource={child.htmlElement == 'Image' && child.HTMLInfo.Src ? child.HTMLInfo.Src : null}
197197
/>
198198
))
199-
.sort((rectA, rectB) => rectA.props.width * rectA.props.height < rectB.props.width * rectB.props.height) // shouldnt this be subtraction instead of < ? see MDN
199+
.sort((rectA, rectB) => rectB.props.width * rectB.props.height - rectA.props.width * rectA.props.height) // shouldnt this be subtraction instead of < ? see MDN
200200
// reasoning for the sort:
201201
// Konva determines zIndex (which rect is clicked on if rects overlap) based on rendering order
202202
// as long as the smallest components are rendered last they will always be accessible over the big boys

src/public/styles/style.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
box-sizing: inherit;
55
}
66

7+
* {
8+
overflow: hidden;
9+
overflow-y: hidden;
10+
-ms-overflow-style: none;
11+
scrollbar-width: none;
12+
}
13+
714
html {
815
box-sizing: border-box;
916
overflow: hidden;
@@ -14,6 +21,7 @@ body {
1421
padding: 0;
1522
font-family: 'Open sans', sans-serif;
1623
font-weight: 400;
24+
overflow: hidden;
1725
}
1826

1927
/*

0 commit comments

Comments
 (0)