Restore fill style

This commit is contained in:
hazam 2020-01-04 02:52:47 +05:00
parent 2a0eacbeca
commit 1b93888da5

View File

@ -215,10 +215,10 @@ function renderScene(
}); });
// horizontal scrollbar // horizontal scrollbar
context.fillStyle = SCROLLBAR_COLOR;
const sceneWidth = canvasWidth + Math.abs(sceneState.scrollX); const sceneWidth = canvasWidth + Math.abs(sceneState.scrollX);
const scrollBarWidth = (canvasWidth * canvasWidth) / sceneWidth; const scrollBarWidth = (canvasWidth * canvasWidth) / sceneWidth;
const scrollBarX = sceneState.scrollX > 0 ? 0 : canvasWidth - scrollBarWidth; const scrollBarX = sceneState.scrollX > 0 ? 0 : canvasWidth - scrollBarWidth;
context.fillStyle = SCROLLBAR_COLOR;
context.fillRect( context.fillRect(
scrollBarX + SCROLLBAR_MARGIN, scrollBarX + SCROLLBAR_MARGIN,
canvasHeight - SCROLLBAR_WIDTH - SCROLLBAR_MARGIN, canvasHeight - SCROLLBAR_WIDTH - SCROLLBAR_MARGIN,
@ -231,13 +231,13 @@ function renderScene(
const scrollBarHeight = (canvasHeight * canvasHeight) / sceneHeight; const scrollBarHeight = (canvasHeight * canvasHeight) / sceneHeight;
const scrollBarY = const scrollBarY =
sceneState.scrollY > 0 ? 0 : canvasHeight - scrollBarHeight; sceneState.scrollY > 0 ? 0 : canvasHeight - scrollBarHeight;
context.fillStyle = SCROLLBAR_COLOR;
context.fillRect( context.fillRect(
canvasWidth - SCROLLBAR_WIDTH - SCROLLBAR_MARGIN, canvasWidth - SCROLLBAR_WIDTH - SCROLLBAR_MARGIN,
scrollBarY + SCROLLBAR_MARGIN, scrollBarY + SCROLLBAR_MARGIN,
SCROLLBAR_WIDTH, SCROLLBAR_WIDTH,
scrollBarHeight - SCROLLBAR_WIDTH * 2 scrollBarHeight - SCROLLBAR_WIDTH * 2
); );
context.fillStyle = fillStyle;
} }
function exportAsPNG({ function exportAsPNG({
@ -695,7 +695,7 @@ class App extends React.Component<{}, AppState> {
<canvas <canvas
id="canvas" id="canvas"
width={window.innerWidth} width={window.innerWidth}
height={window.innerHeight - 200} height={window.innerHeight - 210}
onWheel={e => { onWheel={e => {
e.preventDefault(); e.preventDefault();
const { deltaX, deltaY } = e; const { deltaX, deltaY } = e;