|
@@ -1,5 +1,7 @@
|
|
import VectorType from "../enum/VectorType.js";
|
|
import VectorType from "../enum/VectorType.js";
|
|
import SelectState from "../enum/SelectState.js";
|
|
import SelectState from "../enum/SelectState.js";
|
|
|
|
+import VectorCategory from "../enum/VectorCategory.js";
|
|
|
|
+import { dataService } from "./DataService.js";
|
|
|
|
|
|
export default class StateService {
|
|
export default class StateService {
|
|
constructor() {
|
|
constructor() {
|
|
@@ -27,12 +29,12 @@ export default class StateService {
|
|
this.selectItem.vectorId = vectorId;
|
|
this.selectItem.vectorId = vectorId;
|
|
this.selectItem.type = type;
|
|
this.selectItem.type = type;
|
|
|
|
|
|
- if (type == VectorType.Text) {
|
|
|
|
- if (state == SelectState.Select) {
|
|
|
|
- this.selectItem.selectIndex = SelectState.Select;
|
|
|
|
- } else {
|
|
|
|
- this.selectItem.selectIndex = state;
|
|
|
|
- }
|
|
|
|
|
|
+ if (type == VectorType.Line) {
|
|
|
|
+ const line = dataService.getLine(vectorId);
|
|
|
|
+ this.selectItem.category = line.getCategory();
|
|
|
|
+ } else if (type == VectorType.Point) {
|
|
|
|
+ const point = dataService.getPoint(vectorId);
|
|
|
|
+ this.selectItem.category = point.getCategory();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -50,6 +52,13 @@ export default class StateService {
|
|
|
|
|
|
setDraggingItem(draggingItem) {
|
|
setDraggingItem(draggingItem) {
|
|
this.draggingItem = draggingItem;
|
|
this.draggingItem = draggingItem;
|
|
|
|
+ if (this.draggingItem.type == VectorType.Line) {
|
|
|
|
+ const line = dataService.getLine(this.draggingItem.vectorId);
|
|
|
|
+ this.draggingItem.category = line.getCategory();
|
|
|
|
+ } else if (this.draggingItem.type == VectorType.Point) {
|
|
|
|
+ const point = dataService.getPoint(this.draggingItem.vectorId);
|
|
|
|
+ this.draggingItem.category = point.getCategory();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
clearDraggingItem() {
|
|
clearDraggingItem() {
|
|
@@ -62,6 +71,13 @@ export default class StateService {
|
|
|
|
|
|
setFocusItem(focusItem) {
|
|
setFocusItem(focusItem) {
|
|
this.focusItem = focusItem;
|
|
this.focusItem = focusItem;
|
|
|
|
+ if (this.focusItem.type == VectorType.Line) {
|
|
|
|
+ const line = dataService.getLine(this.focusItem.vectorId);
|
|
|
|
+ this.focusItem.category = line.getCategory();
|
|
|
|
+ } else if (this.focusItem.type == VectorType.Point) {
|
|
|
|
+ const point = dataService.getPoint(this.focusItem.vectorId);
|
|
|
|
+ this.focusItem.category = point.getCategory();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
clearFocusItem() {
|
|
clearFocusItem() {
|