Files
artcraft/src/KonvaApp/EngineUtitlities/VideoExtractionHandler/PointsStack.ts
T
wil bef495fc36 feature / Video Extraction UI v2 (#68)
* refactor of existing features should work perfect

* redo undo of adding points works

* multi session fix

* undo redo implemented correctly, include exclusion button

* exclusion point functional

* point stack object

* clear extraction data from video node as well
2024-11-26 21:13:59 -05:00

36 lines
935 B
TypeScript

import { Coordinates } from "~/Classes/ApiManager/SegmentationApi";
import { uiAccess } from "~/signals";
export class PointsStack {
private points: Coordinates[];
constructor() {
this.points = [];
}
public get() {
return this.points;
}
public addPoint(point: Coordinates) {
this.points.push(point);
uiAccess.toolbarVideoExtraction.setReady(true);
}
public pop() {
this.points.pop();
if (this.points.length === 0) {
uiAccess.toolbarVideoExtraction.setReady(false);
}
}
public removePoint(point: Coordinates) {
this.points = this.points.filter(
(curr) =>
curr.coordinates[0] !== point.coordinates[0] &&
curr.coordinates[1] != point.coordinates[1],
);
if (this.points.length === 0) {
uiAccess.toolbarVideoExtraction.setReady(false);
}
}
public clear() {
this.points = [];
uiAccess.toolbarVideoExtraction.setReady(false);
}
}