|
|
|
@ -127,13 +127,13 @@ async function handle_event(event) {
@@ -127,13 +127,13 @@ async function handle_event(event) {
|
|
|
|
|
const other_event = storage.events[i]; |
|
|
|
|
if (other_event.type === EVENT.STROKE && other_event.user_id === event.user_id && !other_event.deleted) { |
|
|
|
|
other_event.deleted = true; |
|
|
|
|
const stats = stroke_stats(other_event.points, storage.cursor.width); |
|
|
|
|
redraw_region(stats.bbox); |
|
|
|
|
// const stats = stroke_stats(other_event.points, storage.cursor.width);
|
|
|
|
|
// redraw_region(stats.bbox);
|
|
|
|
|
break; |
|
|
|
|
} else if (other_event.type === EVENT.IMAGE && other_event.user_id === event.user_id && !other_event.deleted) { |
|
|
|
|
other_event.deleted = true; |
|
|
|
|
const bbox = bitmap_bbox(other_event); |
|
|
|
|
redraw_region(bbox); |
|
|
|
|
// other_event.deleted = true;
|
|
|
|
|
// const bbox = bitmap_bbox(other_event);
|
|
|
|
|
// redraw_region(bbox);
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -142,14 +142,19 @@ async function handle_event(event) {
@@ -142,14 +142,19 @@ async function handle_event(event) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case EVENT.IMAGE: { |
|
|
|
|
const r = await fetch(config.image_url + event.image_id); |
|
|
|
|
const blob = await r.blob(); |
|
|
|
|
const bitmap = await createImageBitmap(blob); |
|
|
|
|
|
|
|
|
|
event.bitmap = bitmap; |
|
|
|
|
|
|
|
|
|
const bbox = bitmap_bbox(event); |
|
|
|
|
storage.ctx0.drawImage(bitmap, bbox.xmin, bbox.ymin); |
|
|
|
|
const url = config.image_url + event.image_id; |
|
|
|
|
const item = document.createElement('img'); |
|
|
|
|
item.classList.add('floating-image'); |
|
|
|
|
item.style.left = `${event.x}px`; |
|
|
|
|
item.style.top = `${event.y}px`; |
|
|
|
|
item.setAttribute('src', url); |
|
|
|
|
elements.images.appendChild(item); |
|
|
|
|
// const r = await fetch(config.image_url + event.image_id);
|
|
|
|
|
// const blob = await r.blob();
|
|
|
|
|
// const bitmap = await createImageBitmap(blob);
|
|
|
|
|
// event.bitmap = bitmap;
|
|
|
|
|
// const bbox = bitmap_bbox(event);
|
|
|
|
|
// storage.ctx0.drawImage(bitmap, bbox.xmin, bbox.ymin);
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|