|
|
@ -63,6 +63,11 @@ function ser_u32(s, value) { |
|
|
|
s.offset += 4; |
|
|
|
s.offset += 4; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ser_s32(s, value) { |
|
|
|
|
|
|
|
s.view.setInt32(s.offset, value, true); |
|
|
|
|
|
|
|
s.offset += 4; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function ser_align(s, to) { |
|
|
|
function ser_align(s, to) { |
|
|
|
// TODO: non-stupid version of this
|
|
|
|
// TODO: non-stupid version of this
|
|
|
|
while (s.offset % to != 0) { |
|
|
|
while (s.offset % to != 0) { |
|
|
@ -93,7 +98,14 @@ function ser_event(s, event) { |
|
|
|
case EVENT.MOVE_CANVAS: { |
|
|
|
case EVENT.MOVE_CANVAS: { |
|
|
|
ser_u32(s, event.offset_x); |
|
|
|
ser_u32(s, event.offset_x); |
|
|
|
ser_u32(s, event.offset_y); |
|
|
|
ser_u32(s, event.offset_y); |
|
|
|
ser_f32(s, event.zoom); |
|
|
|
ser_s32(s, event.zoom_level); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case EVENT.ZOOM_CANVAS: { |
|
|
|
|
|
|
|
ser_s32(s, event.zoom_level); |
|
|
|
|
|
|
|
ser_f32(s, event.zoom_cx); |
|
|
|
|
|
|
|
ser_f32(s, event.zoom_cy); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -366,7 +378,16 @@ function movecanvas_event(state) { |
|
|
|
'type': EVENT.MOVE_CANVAS, |
|
|
|
'type': EVENT.MOVE_CANVAS, |
|
|
|
'offset_x': state.canvas.offset.x, |
|
|
|
'offset_x': state.canvas.offset.x, |
|
|
|
'offset_y': state.canvas.offset.y, |
|
|
|
'offset_y': state.canvas.offset.y, |
|
|
|
'zoom': state.canvas.zoom, |
|
|
|
'zoom_level': state.canvas.zoom_level, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function zoomcanvas_event(state, zoom_cx, zoom_cy) { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
'type': EVENT.ZOOM_CANVAS, |
|
|
|
|
|
|
|
'zoom_level': state.canvas.zoom_level, |
|
|
|
|
|
|
|
'zoom_cx': zoom_cx, |
|
|
|
|
|
|
|
'zoom_cy': zoom_cy, |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|