diff --git a/src/iscs_new/controller.js b/src/iscs_new/controller.js index 26a5fe083..ef296a416 100644 --- a/src/iscs_new/controller.js +++ b/src/iscs_new/controller.js @@ -48,7 +48,6 @@ export default class Controller extends Eventful { this._isNotLeftMouse = false; this._shortcuts = ''; this._distance = 0; - this._locking = false; this._target = null; this.initModule(map); this.initHandler(map); @@ -147,9 +146,11 @@ export default class Controller extends Eventful { } isSelected(code) { - return this.$controller - ? this.$controller.storage.has(code) - : false; + return this.storage.has(code) + } + + setTarget(target) { + this._target = target; } setCursorStyle(cursorStyle) { @@ -189,11 +190,13 @@ export default class Controller extends Eventful { } else { this.selectingHandle.clear(e); if (this.isSpecialSubType(event)) { return; } - if (this._dragEnable && this._locking) { - this.trigger(this.events.__DragStart, { x: e.offsetX, y: e.offsetY, code: event.code }); - } else if (this._areaSelectEnable) { + if (this._areaSelectEnable) { this.trigger(this.events.__SelectStart, { x: e.offsetX, y: e.offsetY}); } + + if (this._dragEnable) { + this.trigger(this.events.__DragStart, { x: e.offsetX, y: e.offsetY, code: event.code }); + } } } @@ -240,7 +243,9 @@ export default class Controller extends Eventful { } else { if (this._dragEnable && this.dragHandle.isDragging()) { this.trigger(this.events.__DragEnd, {x: e.offsetX, y: e.offsetY}); - } else if (this._areaSelectEnable && this.selectingHandle.isSelecting()) { + } + + if (this._areaSelectEnable && this.selectingHandle.isSelecting()) { this.trigger(this.events.__SelectEnd, { x: e.offsetX, y: e.offsetY }); } @@ -281,9 +286,7 @@ export default class Controller extends Eventful { const event = new MouseEvent(this, e); this.trigger(events.Selected, event); - if (event.code) { - this.setLocking(true) - } else { + if (!event.code) { this.selectHandle.clear(); this.selectingHandle.clear(); this.clear(); @@ -331,7 +334,6 @@ export default class Controller extends Eventful { this.storage.clear(); this.storage.clearClipboard(); this._pan = false; - this._locking = false; } getKeyStr() { @@ -342,10 +344,6 @@ export default class Controller extends Eventful { return this._target; } - setLocking(lock=false) { - this._locking = lock; - } - destroy () { this.dispose(); } diff --git a/src/iscs_new/core/abstractShape.js b/src/iscs_new/core/abstractShape.js index 46bb79742..e00ee813d 100644 --- a/src/iscs_new/core/abstractShape.js +++ b/src/iscs_new/core/abstractShape.js @@ -1,12 +1,12 @@ import * as graphic from '../core/graphic'; import shapeRender from '../constant/shapeRender'; -function shapeStyleBuilder() { +function shapeStyleBuilder(model) { return { + code: model.code, subType: '__hover__', ...shapeRender, z: 9998, - silent: true, cursor: 'pointer', shape: { x: 0, @@ -28,7 +28,7 @@ class AbstractShape { this.model = model; this.option = option; this.shapeFactory = shapeFactory; - this.hightLightInstance = new graphic.Rect(shapeStyleBuilder()); + this.hightLightInstance = new graphic.Rect(shapeStyleBuilder(this.model)); } // 拖动 diff --git a/src/iscs_new/factory/index.js b/src/iscs_new/factory/index.js index 5f2360848..300eab13b 100644 --- a/src/iscs_new/factory/index.js +++ b/src/iscs_new/factory/index.js @@ -29,7 +29,7 @@ function shapeStyleBuilder() { height: 0 }, style: { - lineDash: [3, 6], + lineDash: [4, 4], lineWidth: 1, stroke: '#000', fill: 'transparent' diff --git a/src/iscs_new/selectHandle.js b/src/iscs_new/selectHandle.js index 0dd337d2a..c8f98671b 100644 --- a/src/iscs_new/selectHandle.js +++ b/src/iscs_new/selectHandle.js @@ -18,6 +18,7 @@ export default class SelectHandle { this.e = {...e}; if (['Control'].includes(this.$controller.getKeyStr())) { if (this.$controller.isSelected(e.target.model.code)) { + this.$controller.setTarget(null); this.delSelected(e.target); } else { this.addSelected(e.target); diff --git a/src/iscs_new/selectingHandle.js b/src/iscs_new/selectingHandle.js index 839ec8c0d..40ff3dcec 100644 --- a/src/iscs_new/selectingHandle.js +++ b/src/iscs_new/selectingHandle.js @@ -57,12 +57,8 @@ export default class SelectingHandle { const selectingRect = this.selecting.getBoundingRect(); Object.values(this.$map.getMapShape()).forEach(el => { - if (el.model && this.checkSelectingRectContainShape(selectingRect, el)) { - if (!el.model.composeCode) { - this.setSelected(el); - this.$controller.setLocking(true); - // el.shapeFactory.showHightLight(el); - } + if (el.model && !el.model.composeCode && this.checkSelectingRectContainShape(selectingRect, el)) { + this.setSelected(el); } }); diff --git a/src/views/test/index.vue b/src/views/test/index.vue index 339484a4b..56cf106c0 100644 --- a/src/views/test/index.vue +++ b/src/views/test/index.vue @@ -227,12 +227,18 @@ export default { code: '100', type: 'Device', elementCodes: ['1', '2'], - composeCode: '101', + composeCode: '1000', }, { code: '101', type: 'Device', - elementCodes: ['3', '4', '100'], + elementCodes: ['3', '4'], + composeCode: '1000' + }, + { + code: '1000', + type: 'Combine', + elementCodes: ['100', '101'], composeCode: '' } ]