mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
mouse handler names
This commit is contained in:
parent
b4492dcb73
commit
7650fb16a5
1 changed files with 11 additions and 6 deletions
|
@ -3,9 +3,10 @@
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
viewBox="0 0 1000 1000"
|
viewBox="0 0 1000 1000"
|
||||||
preserveAspectRatio="none"
|
preserveAspectRatio="none"
|
||||||
@pointerdown="on_pointerdown"
|
@mousedown.left="draw_start"
|
||||||
@pointermove="on_pointermove"
|
@mousemove="on_mousemove"
|
||||||
@pointerup="on_pointerup"
|
@mouseup.left="draw_finish"
|
||||||
|
@contextmenu.prevent=""
|
||||||
>
|
>
|
||||||
<Rect
|
<Rect
|
||||||
v-if="preview_state.visible"
|
v-if="preview_state.visible"
|
||||||
|
@ -52,7 +53,7 @@ export default class RectPad extends Vue {
|
||||||
private readonly min_rect_area = 4;
|
private readonly min_rect_area = 4;
|
||||||
private rectangles: Rectangle[] = [];
|
private rectangles: Rectangle[] = [];
|
||||||
|
|
||||||
private on_pointerdown(event: MouseEvent) {
|
private draw_start(event: MouseEvent) {
|
||||||
if (this.preview_state.visible) {
|
if (this.preview_state.visible) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -62,11 +63,15 @@ export default class RectPad extends Vue {
|
||||||
this.preview_state.corner2 = get_event_thous(event);
|
this.preview_state.corner2 = get_event_thous(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
private on_pointermove(event: MouseEvent) {
|
private on_mousemove(event: MouseEvent) {
|
||||||
|
if (!this.preview_state.visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.preview_state.corner2 = get_event_thous(event);
|
this.preview_state.corner2 = get_event_thous(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
private on_pointerup() {
|
private draw_finish() {
|
||||||
this.preview_state.visible = false;
|
this.preview_state.visible = false;
|
||||||
if (this.preview_rectangle.area >= this.min_rect_area) {
|
if (this.preview_rectangle.area >= this.min_rect_area) {
|
||||||
this.rectangles.push(this.preview_rectangle);
|
this.rectangles.push(this.preview_rectangle);
|
||||||
|
|
Loading…
Reference in a new issue