From cdfad4124d6849bf726419c23d4200d2bf897d20 Mon Sep 17 00:00:00 2001 From: HF Date: Fri, 20 Nov 2020 12:14:36 +0100 Subject: [PATCH] add setscale to extensions, remove pixelupdate, dont emit center on receivechunk (redundant because chunk.cell exists) --- src/store/extensions.js | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/store/extensions.js b/src/store/extensions.js index 769b41b..83d83ab 100644 --- a/src/store/extensions.js +++ b/src/store/extensions.js @@ -18,7 +18,7 @@ export default () => (next) => (action) => { case 'SET_VIEW_COORDINATES': { /* - * view: [x, y] canvas coordinates of the center of the screen + * view: [x, y] float canvas coordinates of the center of the screen, */ pixelPlanetEvents.emit('setviewcoordinates', action.view); break; @@ -26,34 +26,30 @@ export default () => (next) => (action) => { case 'SET_HOVER': { /* - * hover: [x, y] canvas coordinates of cursor + * hover: [x, y] integer canvas coordinates of cursor * just used on 2D canvas */ pixelPlanetEvents.emit('sethover', action.hover); break; } - case 'RECEIVE_BIG_CHUNK': { + case 'SET_SCALE': { /* - * center: Array with [zoom, x, y] on 2D and [0, x, z] on 3D canvas - * chunk: ChunkRGB or ChunkRGB3D object, - * see ui/ChunkRGB.js and ui/ChunkRGB3D.js + * scale: float of canvas scale aka zoom + * (not logarithmic, doesn't clamp to 1.0) + * zoompoint: center of scaling */ - const { center, chunk } = action; - pixelPlanetEvents.emit('receivechunk', center, chunk); + const { scale, zoompoint } = action; + pixelPlanetEvents.emit('setscale', scale, zoompoint); break; } - case 'RECEIVE_PIXEL_UPDATE': { + case 'RECEIVE_BIG_CHUNK': { /* - * i, j: chunk coordinates - * offset: position of pixel within chunk - * color: color index + * chunk: ChunkRGB or ChunkRGB3D object, + * see ui/ChunkRGB.js and ui/ChunkRGB3D.js */ - const { - i, j, offset, color, - } = action; - pixelPlanetEvents.emit('pixelupdate', i, j, offset, color); + pixelPlanetEvents.emit('receivechunk', action.chunk); break; }