add setscale to extensions, remove pixelupdate, dont emit center on receivechunk (redundant because chunk.cell exists)

This commit is contained in:
HF 2020-11-20 12:14:36 +01:00
parent 9a47b90e04
commit cdfad4124d

View File

@ -18,7 +18,7 @@ export default () => (next) => (action) => {
case 'SET_VIEW_COORDINATES': { 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); pixelPlanetEvents.emit('setviewcoordinates', action.view);
break; break;
@ -26,34 +26,30 @@ export default () => (next) => (action) => {
case 'SET_HOVER': { case 'SET_HOVER': {
/* /*
* hover: [x, y] canvas coordinates of cursor * hover: [x, y] integer canvas coordinates of cursor
* just used on 2D canvas * just used on 2D canvas
*/ */
pixelPlanetEvents.emit('sethover', action.hover); pixelPlanetEvents.emit('sethover', action.hover);
break; break;
} }
case 'RECEIVE_BIG_CHUNK': { case 'SET_SCALE': {
/* /*
* center: Array with [zoom, x, y] on 2D and [0, x, z] on 3D canvas * scale: float of canvas scale aka zoom
* chunk: ChunkRGB or ChunkRGB3D object, * (not logarithmic, doesn't clamp to 1.0)
* see ui/ChunkRGB.js and ui/ChunkRGB3D.js * zoompoint: center of scaling
*/ */
const { center, chunk } = action; const { scale, zoompoint } = action;
pixelPlanetEvents.emit('receivechunk', center, chunk); pixelPlanetEvents.emit('setscale', scale, zoompoint);
break; break;
} }
case 'RECEIVE_PIXEL_UPDATE': { case 'RECEIVE_BIG_CHUNK': {
/* /*
* i, j: chunk coordinates * chunk: ChunkRGB or ChunkRGB3D object,
* offset: position of pixel within chunk * see ui/ChunkRGB.js and ui/ChunkRGB3D.js
* color: color index
*/ */
const { pixelPlanetEvents.emit('receivechunk', action.chunk);
i, j, offset, color,
} = action;
pixelPlanetEvents.emit('pixelupdate', i, j, offset, color);
break; break;
} }