|
@@ -1,17 +1,12 @@
|
|
|
import { ModuleControl } from "queenjs";
|
|
|
import { reactive } from "vue";
|
|
|
import { EditorModule } from "../../module";
|
|
|
-import { DesignComp } from "../../objects/DesignTemp/DesignComp";
|
|
|
-import { Matrix } from "./matrix";
|
|
|
-import { GroupActionCtrl } from "../TransferCtrl/GroupCtrl";
|
|
|
-import { Point } from "./objects/point";
|
|
|
import { ObjsContainer } from "./ObjsContainer";
|
|
|
-import Event from "./event";
|
|
|
-import { DisplayObject } from "./objects/displayObject";
|
|
|
import { CompObject } from "./compObj";
|
|
|
-import { each, eachRight } from "lodash";
|
|
|
-import { string } from "vue-types";
|
|
|
+import Event from "./event";
|
|
|
+import { Matrix } from "./matrix";
|
|
|
import { Project, VectorLenth } from "./objects/mathUtils";
|
|
|
+import { Point } from "./objects/point";
|
|
|
|
|
|
/**
|
|
|
* 页面画布空间进行选择
|
|
@@ -81,9 +76,6 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
this._selCanvaseSize.h = selCanvas.height * 2;
|
|
|
|
|
|
viewport.addEventListener("mousedown", this.onDocMouseDown.bind(this), {capture: true});
|
|
|
- viewport.addEventListener("mousemove", this.onDocMouseMove.bind(this), {capture: true});
|
|
|
- viewport.addEventListener("mouseup", this.onDocMouseUp.bind(this), {capture: true});
|
|
|
-
|
|
|
window.addEventListener("resize", this.onResize.bind(this));
|
|
|
}
|
|
|
|
|
@@ -94,10 +86,12 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
this._mouseDownTimestamp = Date.now();
|
|
|
|
|
|
if (!this.pageEl || !this.selCanvas) return;
|
|
|
+ if (this.store.textEditingState) return;
|
|
|
+
|
|
|
+ document.addEventListener("mousemove", this.onDocMouseMove, {capture: true});
|
|
|
+ //mouseup和click都会被触发, 监听click事件可以阻止子组件的点击行为
|
|
|
+ document.addEventListener("click", this.onDocMouseUp.bind(this), {capture: true, once: true});
|
|
|
|
|
|
- if (this.store.textEditingState) {
|
|
|
- return
|
|
|
- }
|
|
|
let box = this.pageEl.getBoundingClientRect();
|
|
|
const pageX = e.clientX - box?.left;
|
|
|
const pageY = e.clientY - box?.top;
|
|
@@ -275,7 +269,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
_movePreClientX = 0;
|
|
|
_movePreClientY = 0;
|
|
|
|
|
|
- onDocMouseMove(e: MouseEvent) {
|
|
|
+ onDocMouseMove = (e: MouseEvent) => {
|
|
|
if (!this.pageEl) return;
|
|
|
// if (!this._downed) {
|
|
|
// this.checkHover();
|
|
@@ -309,6 +303,8 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
}
|
|
|
|
|
|
onDocMouseUp(e: MouseEvent) {
|
|
|
+ document.removeEventListener("mousemove", this.onDocMouseMove, {capture: true});
|
|
|
+
|
|
|
if (this._mouseDownFlag == "toolbar") {
|
|
|
return;
|
|
|
}
|
|
@@ -320,7 +316,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
if (dx < 2 && dy < 2 && !this.store.textEditingState && offsetT < 200) {
|
|
|
isClick = true;
|
|
|
}
|
|
|
- if (isClick) {
|
|
|
+ if (isClick) {
|
|
|
this._state = MODE_NONE;
|
|
|
const comps = this.compClickTest(e);
|
|
|
if (comps.length < 1) {
|
|
@@ -328,6 +324,8 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
this.selecteObjs([]);
|
|
|
}, 0);
|
|
|
}
|
|
|
+ } else{
|
|
|
+ e.stopPropagation();
|
|
|
}
|
|
|
console.log("up");
|
|
|
|