|
@@ -66,7 +66,7 @@ export class DivideFloorScene extends FloorScene {
|
|
|
/** 类空间itemList */
|
|
|
likeSpaceList: LikeSpaceItem[] = [];
|
|
|
/** 高亮item */
|
|
|
- highLight: HighlightItem = new HighlightItem(null);
|
|
|
+ highLight: HighlightItem | null = null;
|
|
|
/** 是否开启切分 */
|
|
|
isCutting: boolean = false;
|
|
|
/** 业务空间是否可选 */
|
|
@@ -116,7 +116,6 @@ export class DivideFloorScene extends FloorScene {
|
|
|
*/
|
|
|
constructor() {
|
|
|
super();
|
|
|
- this.addItem(this.highLight);
|
|
|
} // Constructor
|
|
|
|
|
|
/**
|
|
@@ -256,7 +255,11 @@ export class DivideFloorScene extends FloorScene {
|
|
|
if (event.buttons == 1) {
|
|
|
if (this.isMarking) {
|
|
|
// 判断是否开启吸附,并且有吸附的点
|
|
|
- if (this.isAbsorbing && this.highLight.visible) {
|
|
|
+ if (
|
|
|
+ this.isAbsorbing &&
|
|
|
+ this.highLight &&
|
|
|
+ this.highLight.visible
|
|
|
+ ) {
|
|
|
event.x = this.highLight.point.x;
|
|
|
event.y = this.highLight.point.y;
|
|
|
}
|
|
@@ -274,7 +277,11 @@ export class DivideFloorScene extends FloorScene {
|
|
|
}
|
|
|
} else if (this.isCutting) {
|
|
|
// 判断是否开启吸附,并且有吸附的点
|
|
|
- if (this.isAbsorbing && this.highLight.visible) {
|
|
|
+ if (
|
|
|
+ this.isAbsorbing &&
|
|
|
+ this.highLight &&
|
|
|
+ this.highLight.visible
|
|
|
+ ) {
|
|
|
event.x = this.highLight.point.x;
|
|
|
event.y = this.highLight.point.y;
|
|
|
}
|
|
@@ -345,8 +352,12 @@ export class DivideFloorScene extends FloorScene {
|
|
|
return false;
|
|
|
}
|
|
|
super.onMouseMove(event);
|
|
|
- this.highLight.visible = false;
|
|
|
if (this.isAbsorbing) {
|
|
|
+ if (!this.highLight) {
|
|
|
+ this.highLight = new HighlightItem(null);
|
|
|
+ this.addItem(this.highLight);
|
|
|
+ }
|
|
|
+ this.highLight.visible = false;
|
|
|
if (!this.absorbShade(event)) {
|
|
|
this.absorbSpace(event);
|
|
|
}
|
|
@@ -452,6 +463,9 @@ export class DivideFloorScene extends FloorScene {
|
|
|
* @return boolean 是否找到吸附的对象
|
|
|
*/
|
|
|
absorbSpace(event: SMouseEvent): boolean {
|
|
|
+ if (!this.highLight) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
let absorbLen = 1000;
|
|
|
if (this.view) {
|
|
|
absorbLen = 10 / this.view.scale;
|
|
@@ -593,6 +607,9 @@ export class DivideFloorScene extends FloorScene {
|
|
|
* @return boolean 是否找到吸附的对象
|
|
|
*/
|
|
|
absorbShade(event: SMouseEvent): boolean {
|
|
|
+ if (!this.highLight) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
let absorbLen = 1000;
|
|
|
if (this.view) {
|
|
|
absorbLen = 10 / this.view.scale;
|