Skip to content

Commit

Permalink
default white
Browse files Browse the repository at this point in the history
  • Loading branch information
supreme2580 committed Dec 18, 2024
1 parent cf3e42e commit 6d0c214
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions frontend/src/canvas/Canvas.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useEffect } from 'react';
import React, { useEffect } from 'react';
import './Canvas.css';
import { backendUrl } from '../utils/Consts.js';
import canvasConfig from '../configs/canvas.config.json';
Expand All @@ -10,15 +10,6 @@ const Canvas = (props) => {
}
}, [props.width, props.height]);

const draw = useCallback(
(ctx, imageData) => {
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.imageSmoothingEnabled = false;
ctx.putImageData(imageData, 0, 0);
},
[props.width, props.height]
);

const isCenterCanvas =
props.style &&
props.style.width === props.width * props.canvasScale &&
Expand Down Expand Up @@ -47,7 +38,7 @@ const Canvas = (props) => {
if (props.colors.length === 0) {
return;
}

context.imageSmoothingEnabled = false;

let getCanvasEndpoint =
Expand All @@ -64,7 +55,7 @@ const Canvas = (props) => {
let oneByteBitOffset = 8 - bitwidth;
let twoByteBitOffset = 16 - bitwidth;
let canvasBits = props.width * props.height * bitwidth;

for (let bitPos = 0; bitPos < canvasBits; bitPos += bitwidth) {
let bytePos = Math.floor(bitPos / 8);
let bitOffset = bitPos % 8;
Expand Down Expand Up @@ -93,7 +84,13 @@ const Canvas = (props) => {
};

fetchCanvas();
}, [props.colors, props.width, props.height, props.openedWorldId, props.isEmpty]);
}, [
props.colors,
props.width,
props.height,
props.openedWorldId,
props.isEmpty
]);

const displayWidth = props.isCenter ? props.width : 256;
const displayHeight = props.isCenter ? props.height : 192;
Expand Down

0 comments on commit 6d0c214

Please sign in to comment.