|
|
|
@ -359,7 +359,7 @@ function handle_event(state, context, event, options = {}) {
@@ -359,7 +359,7 @@ function handle_event(state, context, event, options = {}) {
|
|
|
|
|
if (other_event.user_id === event.user_id && !other_event.deleted) { |
|
|
|
|
if (other_event.type === EVENT.STROKE) { |
|
|
|
|
other_event.deleted = true; |
|
|
|
|
if (other_event.bvh_node) { |
|
|
|
|
if (other_event.bvh_node && !options.skip_bvh) { |
|
|
|
|
bvh_delete_stroke(state, other_event); |
|
|
|
|
} |
|
|
|
|
need_draw = true; |
|
|
|
@ -374,6 +374,10 @@ function handle_event(state, context, event, options = {}) {
@@ -374,6 +374,10 @@ function handle_event(state, context, event, options = {}) {
|
|
|
|
|
// TODO
|
|
|
|
|
console.log('TODO: undo image scale'); |
|
|
|
|
break; |
|
|
|
|
} else if (other_event.type === EVENT.ERASER) { |
|
|
|
|
// TODO
|
|
|
|
|
console.log('TODO: undo eraser'); |
|
|
|
|
break; |
|
|
|
|
} else { |
|
|
|
|
console.error('cant undo event type', other_event.type); |
|
|
|
|
break; |
|
|
|
@ -445,22 +449,11 @@ function handle_event(state, context, event, options = {}) {
@@ -445,22 +449,11 @@ function handle_event(state, context, event, options = {}) {
|
|
|
|
|
|
|
|
|
|
case EVENT.ERASER: { |
|
|
|
|
need_draw = true; |
|
|
|
|
console.error('todo'); |
|
|
|
|
// if (event.deleted) {
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// for (const other_event of state.events) {
|
|
|
|
|
// if (other_event.type === EVENT.STROKE && other_event.stroke_id === event.stroke_id) {
|
|
|
|
|
// // Might already be deleted because of local prediction
|
|
|
|
|
// if (!other_event.deleted) {
|
|
|
|
|
// other_event.deleted = true;
|
|
|
|
|
// const stats = stroke_stats(other_event.points, state.cursor.width);
|
|
|
|
|
// redraw_region(stats.bbox);
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
const stroke = state.events[event.stroke_id]; |
|
|
|
|
stroke.deleted = true; |
|
|
|
|
if (!options.skip_bvh) { |
|
|
|
|
bvh_delete_stroke(state, stroke); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|