mouse handler names

This commit is contained in:
Jörn-Michael Miehe 2023-01-17 22:42:21 +00:00
parent b4492dcb73
commit 7650fb16a5

View file

@ -3,9 +3,10 @@
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 1000 1000"
preserveAspectRatio="none"
@pointerdown="on_pointerdown"
@pointermove="on_pointermove"
@pointerup="on_pointerup"
@mousedown.left="draw_start"
@mousemove="on_mousemove"
@mouseup.left="draw_finish"
@contextmenu.prevent=""
>
<Rect
v-if="preview_state.visible"
@ -52,7 +53,7 @@ export default class RectPad extends Vue {
private readonly min_rect_area = 4;
private rectangles: Rectangle[] = [];
private on_pointerdown(event: MouseEvent) {
private draw_start(event: MouseEvent) {
if (this.preview_state.visible) {
return;
}
@ -62,11 +63,15 @@ export default class RectPad extends Vue {
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);
}
private on_pointerup() {
private draw_finish() {
this.preview_state.visible = false;
if (this.preview_rectangle.area >= this.min_rect_area) {
this.rectangles.push(this.preview_rectangle);