43 lines
884 B
TypeScript
43 lines
884 B
TypeScript
import { DraggablePropsType } from "@/components/Draggable/Draggable";
|
|
import { makeAutoObservable } from "mobx";
|
|
|
|
class PreviewStore {
|
|
width: number = 0;
|
|
height: number = 0;
|
|
x: number = 0;
|
|
y: number = 0;
|
|
|
|
constructor() {
|
|
makeAutoObservable(this);
|
|
}
|
|
|
|
changePreview(x: number, y: number, width: number, height: number) {
|
|
this.x = x;
|
|
this.y = y;
|
|
this.width = width;
|
|
this.height = height;
|
|
}
|
|
|
|
changePreviewX(x: number) {
|
|
this.x = x;
|
|
}
|
|
changePreviewY(y: number) {
|
|
this.y = y;
|
|
}
|
|
changePreviewWidth(width: number) {
|
|
this.width = width;
|
|
}
|
|
changePreviewHeight(height: number) {
|
|
this.height = height;
|
|
}
|
|
|
|
clearPreview() {
|
|
this.width = 0;
|
|
this.height = 0;
|
|
this.x = 0;
|
|
this.y = 0;
|
|
}
|
|
}
|
|
|
|
|
|
export default new PreviewStore(); |