mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 08:13:01 +00:00
"_rectangles" -> "rectangles_array"
This commit is contained in:
parent
c0bc9aee5d
commit
1e5fae0caa
1 changed files with 8 additions and 8 deletions
|
@ -13,7 +13,7 @@
|
||||||
@dblclick.left="remove_rect"
|
@dblclick.left="remove_rect"
|
||||||
>
|
>
|
||||||
<Rect
|
<Rect
|
||||||
v-for="(rect, index) in _rectangles"
|
v-for="(rect, index) in rectangles_array"
|
||||||
:key="'rect' + index"
|
:key="'rect' + index"
|
||||||
:rectangle="rect"
|
:rectangle="rect"
|
||||||
/>
|
/>
|
||||||
|
@ -56,7 +56,7 @@ export default class RectPad extends Vue {
|
||||||
private dragging = false;
|
private dragging = false;
|
||||||
private drag_rect?: Rectangle;
|
private drag_rect?: Rectangle;
|
||||||
private drag_origin = new Vector2D();
|
private drag_origin = new Vector2D();
|
||||||
private _rectangles: Rectangle[] = [];
|
private rectangles_array: Rectangle[] = [];
|
||||||
|
|
||||||
private get preview_visible(): boolean {
|
private get preview_visible(): boolean {
|
||||||
return this.drawing || this.dragging;
|
return this.drawing || this.dragging;
|
||||||
|
@ -70,21 +70,21 @@ export default class RectPad extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
public get rectangles(): Rectangle[] {
|
public get rectangles(): Rectangle[] {
|
||||||
return this._rectangles; //.map((rect) => rect.normalize());
|
return this.rectangles_array; //.map((rect) => rect.normalize());
|
||||||
}
|
}
|
||||||
|
|
||||||
public set rectangles(rects: Rectangle[]) {
|
public set rectangles(rects: Rectangle[]) {
|
||||||
this._rectangles = rects; //.map((rect) => rect.normalize());
|
this.rectangles_array = rects; //.map((rect) => rect.normalize());
|
||||||
}
|
}
|
||||||
|
|
||||||
private pop_rectangle(point: Vector2D): Rectangle | undefined {
|
private pop_rectangle(point: Vector2D): Rectangle | undefined {
|
||||||
const idx = this._rectangles.findIndex((rect) => rect.contains(point));
|
const idx = this.rectangles_array.findIndex((rect) => rect.contains(point));
|
||||||
|
|
||||||
if (idx === -1) {
|
if (idx === -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._rectangles.splice(idx, 1)[0];
|
return this.rectangles_array.splice(idx, 1)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
private draw_start(event: MouseEvent) {
|
private draw_start(event: MouseEvent) {
|
||||||
|
@ -108,7 +108,7 @@ export default class RectPad extends Vue {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._rectangles.push(this.preview_rectangle);
|
this.rectangles_array.push(this.preview_rectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private drag_start(event: MouseEvent) {
|
private drag_start(event: MouseEvent) {
|
||||||
|
@ -136,7 +136,7 @@ export default class RectPad extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dragging = false;
|
this.dragging = false;
|
||||||
this._rectangles.push(this.preview_rectangle);
|
this.rectangles_array.push(this.preview_rectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private on_mousemove(event: MouseEvent) {
|
private on_mousemove(event: MouseEvent) {
|
||||||
|
|
Loading…
Reference in a new issue