From f84d22185720ce7e219d9ef67ddb44f48e3c7d32 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Thu, 8 Apr 2021 11:24:01 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/iscs_new/core/abstractShape.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/iscs_new/core/abstractShape.js b/src/iscs_new/core/abstractShape.js index 5aaada06d..c97c31ef9 100644 --- a/src/iscs_new/core/abstractShape.js +++ b/src/iscs_new/core/abstractShape.js @@ -44,6 +44,7 @@ class AbstractShape extends Group { this.model.base.position[1] = this.model.base.position[1] + dy; this.instance.origin = utils.createOrigin(this.instance); this.instance.transform = utils.createTransform({scale: this.model.base.scale, position: this.model.base.position, rotation: this.model.base.rotation*Math.PI/180}); + this.dirty(); } // 修改属性 From 9a7d6a007bb513d68aa7a1f786c2c9937ab7ea93 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Thu, 8 Apr 2021 13:00:03 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/iscs_new/controller.js | 3 ++- src/iscs_new/core/form/elementConst.js | 2 +- src/iscs_new/core/form/form2Base.js | 2 +- src/iscs_new/core/form/form2ShapeStyle.js | 2 +- src/iscs_new/factory/index.js | 2 +- src/iscs_new/map.js | 3 +++ src/views/iscs_new/iscsDraw/index.vue | 10 +++++++--- src/views/iscs_new/iscsDraw/iscsCanvas.vue | 6 +++++- 8 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/iscs_new/controller.js b/src/iscs_new/controller.js index 0da85f409..7af1a09b4 100644 --- a/src/iscs_new/controller.js +++ b/src/iscs_new/controller.js @@ -197,6 +197,7 @@ export default class Controller extends Eventful { mousemove(e) { const oldX = this._x; const oldY = this._y; + const target = this._target||{} const dx = Math.round(e.offsetX - this._x); const dy = Math.round(e.offsetY - this._y); @@ -218,7 +219,7 @@ export default class Controller extends Eventful { if (this.limitDrag({dx, dy})) { this.trigger(this.events.__Dragging, { dx, dy }); if (this._reflectEnable) { - this.trigger(events.Reflect, {dx, dy}); + this.trigger(events.Reflect, {dx, dy, code: target.code}); } } else { this._x = oldX; diff --git a/src/iscs_new/core/form/elementConst.js b/src/iscs_new/core/form/elementConst.js index 8ab9ba0a9..a546c88c0 100644 --- a/src/iscs_new/core/form/elementConst.js +++ b/src/iscs_new/core/form/elementConst.js @@ -152,7 +152,7 @@ export const elementConst = { rules:[ { required: true, message:'请输入圆角矩形半径', trigger: 'blur' } ], - value: [5, 5, 5, 5], + value: [0, 0, 0, 0], description: '用于创建圆角矩形。左上、右上、右下、左下角的半径依次为 r1、 r2、 r3、 r4。[1, 1, 1, 1]' }] } diff --git a/src/iscs_new/core/form/form2Base.js b/src/iscs_new/core/form/form2Base.js index 70ee4a997..80216eaf6 100644 --- a/src/iscs_new/core/form/form2Base.js +++ b/src/iscs_new/core/form/form2Base.js @@ -30,7 +30,7 @@ export default [ }, { prop: 'sightless', - label: '图形是否不可见', + label: '是否隐藏', type: types.Boolean, rules:[ { required: true, message:'请选择图形是否不可见', trigger: 'blur' } diff --git a/src/iscs_new/core/form/form2ShapeStyle.js b/src/iscs_new/core/form/form2ShapeStyle.js index 8707101f7..0989454dd 100644 --- a/src/iscs_new/core/form/form2ShapeStyle.js +++ b/src/iscs_new/core/form/form2ShapeStyle.js @@ -101,7 +101,7 @@ export default [ }, { prop: 'strokeNoScale', - label: '描边粗细不随缩放而改变', + label: '描边不缩放', type: types.Boolean, value: false, description: '描边粗细不随缩放而改变,不选中时则会根据缩放同比例缩放描边粗细。' diff --git a/src/iscs_new/factory/index.js b/src/iscs_new/factory/index.js index 9dee4e51d..07bed7656 100644 --- a/src/iscs_new/factory/index.js +++ b/src/iscs_new/factory/index.js @@ -56,7 +56,7 @@ function update2List(source, model, action, name='') { i >= 0 && list.splice(i, 1); break; case orders.UPDATE: - Object.assign(list[i]||{}, model) + updateModel = Object.assign(list[i]||{}, model) break; } diff --git a/src/iscs_new/map.js b/src/iscs_new/map.js index 925588ec8..49ea3c234 100644 --- a/src/iscs_new/map.js +++ b/src/iscs_new/map.js @@ -180,6 +180,7 @@ class JMap { if (updateModel) { curShape = this.$shapeFactory.getShapeByCode(updateModel.code); oldShape = this.$shapeFactory.removeShape(curShape); + this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight); this.$painter.remove(oldShape); } }); @@ -188,9 +189,11 @@ class JMap { updateModel = this.isDrawing() ? this.$shapeFactory.updateSource(model, action): model; oldShape = this.$shapeFactory.removeShape(curShape); newShape = this.$shapeFactory.createShape(updateModel, action.shapeType); + this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight); this.$painter.remove(oldShape); this.$shapeFactory.storageShape(newShape) this.$painter.add(newShape); + this.$painter.addToLayer(newShape.type, newShape.instanceHightLight); break; case orders.UNBINDING: oldShape = this.$shapeFactory.removeShape(curShape); diff --git a/src/views/iscs_new/iscsDraw/index.vue b/src/views/iscs_new/iscsDraw/index.vue index a36ef19a9..5bca0e01c 100644 --- a/src/views/iscs_new/iscsDraw/index.vue +++ b/src/views/iscs_new/iscsDraw/index.vue @@ -85,9 +85,13 @@ export default { }, onSelectTab() { }, - onSelected(val) { - if (val) { - this.selected = JSON.parse(JSON.stringify(val)); + onSelected(em) { + if (em.model) { + this.selected = JSON.parse(JSON.stringify(em.model)); + const elem = this.elementList.find(el => el.code == this.selected.type); + if (elem) { + elem.model = this.selected; + } } else { this.selected = null; } diff --git a/src/views/iscs_new/iscsDraw/iscsCanvas.vue b/src/views/iscs_new/iscsDraw/iscsCanvas.vue index ceb6b26a0..b8c3a600d 100644 --- a/src/views/iscs_new/iscsDraw/iscsCanvas.vue +++ b/src/views/iscs_new/iscsDraw/iscsCanvas.vue @@ -96,6 +96,7 @@ export default { this.$iscs.on('viewLoaded', this.onViewLoaded, this); this.$iscs.on('contextmenu', this.onContextMenu, this); this.$iscs.on('selected', this.onSelected, this); + this.$iscs.on('reflect', this.onReflect, this); this.$iscs.on('keyboard', this.onKeyboard, this); window.document.oncontextmenu = function () { return false; @@ -110,8 +111,11 @@ export default { }, // 点击选择事件 onSelected(em={}) { - this.$emit('selected', em.model); + this.$emit('selected', em); }, + onReflect(em={}) { + this.$emit('selected', this.$iscs.getShapeByCode(em.code)); + }, // 右键点击事件 onContextMenu(em={}) { this.$emit('contextMenu', em.model); From 1fb3c04c370932a93166460c888013741e007089 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Thu, 8 Apr 2021 13:10:10 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/iscs_new/core/form/builderFactory.js | 4 +++- src/iscs_new/core/form/parse.js | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) delete mode 100644 src/iscs_new/core/form/parse.js diff --git a/src/iscs_new/core/form/builderFactory.js b/src/iscs_new/core/form/builderFactory.js index d0f07a669..61ab5880f 100644 --- a/src/iscs_new/core/form/builderFactory.js +++ b/src/iscs_new/core/form/builderFactory.js @@ -7,7 +7,9 @@ class BuilderFactory { getFormList() { const elementList = Object.values(elementConst); elementList.forEach(element=>{ - const temp = Object.assign({}, element); + const temp = {}; + temp.code = element.code; + temp.name = element.name; temp.formGroup = []; temp.model = {}; // 添加通用配置 diff --git a/src/iscs_new/core/form/parse.js b/src/iscs_new/core/form/parse.js deleted file mode 100644 index 6c7873f3c..000000000 --- a/src/iscs_new/core/form/parse.js +++ /dev/null @@ -1 +0,0 @@ -// export function coverse From cfed96504b44acd11e4e946f0eb323a1968c6aa4 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Thu, 8 Apr 2021 13:55:07 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/iscs_new/controller.js | 1 + src/iscs_new/core/abstractShape.js | 1 - src/iscs_new/core/form/form2Base.js | 13 ++++++++++++- src/iscs_new/map.js | 4 +++- src/views/iscs_new/iscsDraw/index.vue | 12 +++++++++--- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/iscs_new/controller.js b/src/iscs_new/controller.js index 7af1a09b4..35ea580e6 100644 --- a/src/iscs_new/controller.js +++ b/src/iscs_new/controller.js @@ -326,6 +326,7 @@ export default class Controller extends Eventful { clear() { this.storage.clear(); this.storage.clearClipboard(); + this._target = null; this._pan = false; } diff --git a/src/iscs_new/core/abstractShape.js b/src/iscs_new/core/abstractShape.js index c97c31ef9..5aaada06d 100644 --- a/src/iscs_new/core/abstractShape.js +++ b/src/iscs_new/core/abstractShape.js @@ -44,7 +44,6 @@ class AbstractShape extends Group { this.model.base.position[1] = this.model.base.position[1] + dy; this.instance.origin = utils.createOrigin(this.instance); this.instance.transform = utils.createTransform({scale: this.model.base.scale, position: this.model.base.position, rotation: this.model.base.rotation*Math.PI/180}); - this.dirty(); } // 修改属性 diff --git a/src/iscs_new/core/form/form2Base.js b/src/iscs_new/core/form/form2Base.js index 80216eaf6..3a4ac96ce 100644 --- a/src/iscs_new/core/form/form2Base.js +++ b/src/iscs_new/core/form/form2Base.js @@ -1,7 +1,18 @@ import types from './types'; export default [ - { prop: 'z1', + { + prop: 'name', + label: '名称', + type: types.String, + rules:[ + { required: true, message:'请输入名称', trigger: 'blur' } + ], + value: '<名称>', + description: '控制图形的前后顺序。' + }, + { + prop: 'z1', label: '层级z1', type: types.Number, precision: 0, diff --git a/src/iscs_new/map.js b/src/iscs_new/map.js index 49ea3c234..6bac2816b 100644 --- a/src/iscs_new/map.js +++ b/src/iscs_new/map.js @@ -166,6 +166,7 @@ class JMap { let newShape = null; if (updateModel) { + this.$controller.clear() switch(action.order) { case orders.BINDING: case orders.ADD: @@ -190,13 +191,14 @@ class JMap { oldShape = this.$shapeFactory.removeShape(curShape); newShape = this.$shapeFactory.createShape(updateModel, action.shapeType); this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight); + this.$painter.removeFromLayer(oldShape.type, newShape.instanceHightLight); this.$painter.remove(oldShape); this.$shapeFactory.storageShape(newShape) this.$painter.add(newShape); - this.$painter.addToLayer(newShape.type, newShape.instanceHightLight); break; case orders.UNBINDING: oldShape = this.$shapeFactory.removeShape(curShape); + this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight); this.$painter.remove(oldShape); break; } diff --git a/src/views/iscs_new/iscsDraw/index.vue b/src/views/iscs_new/iscsDraw/index.vue index ea17bd7b9..02e78b02f 100644 --- a/src/views/iscs_new/iscsDraw/index.vue +++ b/src/views/iscs_new/iscsDraw/index.vue @@ -84,6 +84,7 @@ export default { onSave(data) { }, onSelectTab() { + this.selected = null; }, onSelected(em) { if (em.model) { @@ -104,6 +105,7 @@ export default { newModel.type = this.enabledTab; newModel.code = utils.getUID(this.enabledTab); this.$refs.iscsCanvas.doAction([{model: newModel, action: {shapeType: shapeType.Element, order: orders.ADD}}]); + this.clear(this.enabledTab); } }); }, @@ -114,6 +116,7 @@ export default { model.code = this.selected.code; model.type = this.selected.type; this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.UPDATE}}]); + this.clear(this.enabledTab); } }); }, @@ -124,11 +127,14 @@ export default { model.code = this.selected.code; model.type = this.selected.type; this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.DELETE}}]); - this.$refs['dataform' + this.enabledTab][0].init(); - this.selected = null; + this.clear(this.enabledTab); } }); - } + }, + clear(enabledTab) { + this.$refs['dataform' + enabledTab][0].init(); + this.selected = null; + } } }; From 8ad81f244f20cb9a9268edcad2c7d3109292da50 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Thu, 8 Apr 2021 14:00:35 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20elem=20=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=20stateList?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/iscs_new/iscsDraw/index.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/iscs_new/iscsDraw/index.vue b/src/views/iscs_new/iscsDraw/index.vue index 02e78b02f..98304095d 100644 --- a/src/views/iscs_new/iscsDraw/index.vue +++ b/src/views/iscs_new/iscsDraw/index.vue @@ -104,6 +104,7 @@ export default { const newModel = JSON.parse(JSON.stringify(formModel)); newModel.type = this.enabledTab; newModel.code = utils.getUID(this.enabledTab); + newModel.stateList = []; this.$refs.iscsCanvas.doAction([{model: newModel, action: {shapeType: shapeType.Element, order: orders.ADD}}]); this.clear(this.enabledTab); }