|
|
@ -364,7 +364,7 @@ function handle_event(state, context, event, options = {}) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
case EVENT.UNDO: { |
|
|
|
case EVENT.UNDO: { |
|
|
|
geometry_add_dummy_stroke(context); |
|
|
|
geometry_add_dummy_stroke(state, context); |
|
|
|
need_draw = undo(state, context, event, options); |
|
|
|
need_draw = undo(state, context, event, options); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -372,7 +372,7 @@ function handle_event(state, context, event, options = {}) { |
|
|
|
case EVENT.IMAGE: { |
|
|
|
case EVENT.IMAGE: { |
|
|
|
const p = {'x': event.x, 'y': event.y}; |
|
|
|
const p = {'x': event.x, 'y': event.y}; |
|
|
|
|
|
|
|
|
|
|
|
geometry_add_dummy_stroke(context); |
|
|
|
geometry_add_dummy_stroke(state, context); |
|
|
|
add_image(context, event.image_id, null, p, event.width, event.height); |
|
|
|
add_image(context, event.image_id, null, p, event.width, event.height); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
@ -401,7 +401,7 @@ function handle_event(state, context, event, options = {}) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
case EVENT.IMAGE_MOVE: { |
|
|
|
case EVENT.IMAGE_MOVE: { |
|
|
|
geometry_add_dummy_stroke(context); |
|
|
|
geometry_add_dummy_stroke(state, context); |
|
|
|
const image_id = event.image_id; |
|
|
|
const image_id = event.image_id; |
|
|
|
const image = get_image(context, image_id); |
|
|
|
const image = get_image(context, image_id); |
|
|
|
|
|
|
|
|
|
|
@ -415,7 +415,7 @@ function handle_event(state, context, event, options = {}) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
case EVENT.IMAGE_SCALE: { |
|
|
|
case EVENT.IMAGE_SCALE: { |
|
|
|
geometry_add_dummy_stroke(context); |
|
|
|
geometry_add_dummy_stroke(state, context); |
|
|
|
const image_id = event.image_id; |
|
|
|
const image_id = event.image_id; |
|
|
|
const image = get_image(context, image_id); |
|
|
|
const image = get_image(context, image_id); |
|
|
|
|
|
|
|
|
|
|
@ -428,7 +428,7 @@ function handle_event(state, context, event, options = {}) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
case EVENT.ERASER: { |
|
|
|
case EVENT.ERASER: { |
|
|
|
geometry_add_dummy_stroke(context); |
|
|
|
geometry_add_dummy_stroke(state, context); |
|
|
|
need_draw = true; |
|
|
|
need_draw = true; |
|
|
|
const stroke = state.events[event.stroke_id]; |
|
|
|
const stroke = state.events[event.stroke_id]; |
|
|
|
stroke.deleted = true; |
|
|
|
stroke.deleted = true; |
|
|
|