Browse Source

Undo eraser

sdf
A.Olokhtonov 2 months ago
parent
commit
5d45eb3255
  1. 6
      README.txt
  2. 13
      client/bvh.js
  3. 13
      client/client_recv.js

6
README.txt

@ -8,14 +8,14 @@ Release: @@ -8,14 +8,14 @@ Release:
+ Do not copy memory to wasm, instead use wasm memory to store data in the first place
+ SIMD for LOD?
+ Multithreading for LOD
+ Textured quads (pictures, code already written in older version)
+ Textured quads (pictures, code already written in older version
+ Resize and move pictures (draw handles)
- Z-prepass fringe bug (also, when do we enable the prepass?)
+ Bugs
+ GC stalls!!!
+ Stroke previews get connected when drawn without panning on touch devices
+ Redraw HTML (cursors) on local canvas moves
+ New strokes dissapear on the HMH desk
+ New strokes dissapear on the HMH desk
- Debug
- Restore ability to limit event range
* Listeners/events/multiplayer
@ -45,8 +45,8 @@ Release: @@ -45,8 +45,8 @@ Release:
- Live preview
- Alignment (horizontal, vertical, diagonal, etc)
+ Undo
+ Undo for eraser
- Undo for images (add, move, scale)
- Undo for eraser
- Redo
+ Snapping to grid
- Snapping to other points?

13
client/bvh.js

@ -176,6 +176,19 @@ function bvh_delete_stroke(state, stroke) { @@ -176,6 +176,19 @@ function bvh_delete_stroke(state, stroke) {
}
}
function bvh_undelete_stroke(state, stroke) {
let node = state.bvh.nodes[stroke.bvh_node];
while (node.parent_index !== null) {
if (node.is_fullnode) {
tv_add2(node.stroke_indices, stroke.index);
break;
}
node = state.bvh.nodes[node.parent_index];
}
}
function bvh_intersect_quad(state, bvh, quad, result_buffer) {
if (bvh.root === null) {
return;

13
client/client_recv.js

@ -366,17 +366,24 @@ function handle_event(state, context, event, options = {}) { @@ -366,17 +366,24 @@ function handle_event(state, context, event, options = {}) {
break;
} else if (other_event.type === EVENT.UNDO) {
// do not undo an undo, we are not Notepad
} else if (other_event.type === EVENT.IMAGE) {
console.log('TODO: undo image');
} else if (other_event.type === EVENT.IMAGE_MOVE) {
// TODO
console.log('TODO: undo image scale');
console.log('TODO: undo image move');
break;
} else if (other_event.type === EVENT.IMAGE_SCALE) {
// TODO
console.log('TODO: undo image scale');
break;
} else if (other_event.type === EVENT.ERASER) {
// TODO
console.log('TODO: undo eraser');
const stroke = state.events[other_event.stroke_id];
stroke.deleted = false;
if (!options.skip_bvh) {
bvh_undelete_stroke(state, stroke);
}
need_draw = true;
other_event.deleted = true;
break;
} else {
console.error('cant undo event type', other_event.type);

Loading…
Cancel
Save