diff --git a/index.html b/index.html index e2cd81b..7ceb6d7 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@ - DDei-在线设计器V1.2.45 + DDei-在线设计器V1.2.46
diff --git a/package-lock.json b/package-lock.json index a6993a4..6c44e4f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,21 @@ { "name": "ddei-editor", - "version": "1.2.45", + "version": "1.2.46", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ddei-editor", - "version": "1.2.45", + "version": "1.2.46", "license": "Apache License 2.0", + "dependencies": { + "ddei-framework": "^1.2.46" + }, "devDependencies": { "@tsconfig/node18": "^18.2.0", "@types/node": "^18.17.6", "@vitejs/plugin-vue": "^4.2.3", "@vue/tsconfig": "^0.4.0", - "ddei-framework": "^1.2.45", "less": "^4.2.0", "npm-run-all": "^4.1.5", "typescript": "~5.1.6", @@ -496,10 +498,9 @@ } }, "node_modules/ddei-framework": { - "version": "1.2.45", - "resolved": "https://registry.npmjs.org/ddei-framework/-/ddei-framework-1.2.45.tgz", - "integrity": "sha512-vGhRs6GE1c0ScSKGPxQKmETKZ3G/+OV48pQJYsw0bXCbBpWHpN4N/PH9S9zddx9ZfhLY//OMkbHmpmFSVUumfw==", - "dev": true, + "version": "1.2.46", + "resolved": "https://registry.npmjs.org/ddei-framework/-/ddei-framework-1.2.46.tgz", + "integrity": "sha512-jrgZwWvjhtKAUz5K4ktP5PGN/9qXuYGsuG/XkqUq6RfON7Tk0Mg6bFzuO8B0aUusE8uSp7PzuM/x5wS4uNIHug==", "engines": { "node": ">=16.0.0" } diff --git a/package.json b/package.json index 843ae53..7e3242c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ddei-editor", - "version": "1.2.45", + "version": "1.2.46", "private": false, "type": "module", "author": "hoslay <3697355039@qq.com>", @@ -60,6 +60,6 @@ "vite": "^4.4.6", "vite-plugin-compression": "^0.5.1", "vue-tsc": "^1.8.6", - "ddei-framework": "^1.2.45" + "ddei-framework": "^1.2.46" } } diff --git a/plugins/core/controls/control/base/line.ts b/plugins/core/controls/control/base/line.ts index f225178..d9075ef 100644 --- a/plugins/core/controls/control/base/line.ts +++ b/plugins/core/controls/control/base/line.ts @@ -254,5 +254,10 @@ export default { LINE_OBI_FILTER: (model, params)=>{ return false } - } + }, + menus:[ + { name: "ddei-core-menu-disabled-auto-obi" }, + { name: "ddei-core-menu-enable-auto-obi" }, + { name: "ddei-core-menu-sysdefault-auto-obi" } + ] } \ No newline at end of file diff --git a/plugins/core/controls/control/base/polygon.ts b/plugins/core/controls/control/base/polygon.ts index eb4646e..17ad3e5 100644 --- a/plugins/core/controls/control/base/polygon.ts +++ b/plugins/core/controls/control/base/polygon.ts @@ -545,7 +545,7 @@ export default { LINE_OBI_FILTER: (model, params) => { let line = params.line if (line) { - + let distLinks = line.stage.getDistModelLinks(line.id); if (distLinks) { for (let i = 0; i < distLinks.length;i++){ @@ -562,6 +562,13 @@ export default { return false; } } + //如果没有设置自动避障,并且全局也取消自动避障 + + if (!line.autoObiPolicy && !model.stage.ddInstance.GLOBAL_AUTO_OBI) { + return false; + } else if (line.autoObiPolicy == 1){ + return false; + } } return true } diff --git a/plugins/core/hotkeys/actions/key-action-start-quick-edit.ts b/plugins/core/hotkeys/actions/key-action-start-quick-edit.ts index b859757..cf46bd2 100644 --- a/plugins/core/hotkeys/actions/key-action-start-quick-edit.ts +++ b/plugins/core/hotkeys/actions/key-action-start-quick-edit.ts @@ -228,7 +228,7 @@ class DDeiKeyActionStartQuickEdit extends DDeiKeyAction { dataJson["textStyle"] = { paddingWeight: 0 } if (isLineLM){ - dataJson["fill"] = {type:1 ,color: 'white' } + // dataJson["fill"] = {type:1 ,color: 'white' } } for (let i in dataJson) { let value = dataJson[i] diff --git a/plugins/core/i18n/en_US.ts b/plugins/core/i18n/en_US.ts index b55aa05..4953887 100644 --- a/plugins/core/i18n/en_US.ts +++ b/plugins/core/i18n/en_US.ts @@ -79,6 +79,9 @@ export default { paper: 'Paper', propertyName: "Property", searchResult: "Search Result", + enableAutoObi: "Avoiding Obstacles", + disabledAutoObi: "Disable Avoiding Obstacles", + sysDefaultAutoObi: "Default Avoiding Obstacles", property: { id: 'id', code: 'Code', diff --git a/plugins/core/i18n/zh_CN.ts b/plugins/core/i18n/zh_CN.ts index 004e574..706f358 100644 --- a/plugins/core/i18n/zh_CN.ts +++ b/plugins/core/i18n/zh_CN.ts @@ -81,6 +81,9 @@ export default { paper: '纸张', propertyName:"属性", searchResult: "搜索结果", + enableAutoObi: "开启避障", + disabledAutoObi: "关闭避障", + sysDefaultAutoObi: "默认避障", property:{ id:'id', code:'编码', diff --git a/plugins/core/menus/index.ts b/plugins/core/menus/index.ts index 878e4b7..e916d67 100644 --- a/plugins/core/menus/index.ts +++ b/plugins/core/menus/index.ts @@ -7,6 +7,9 @@ import MenuMergeCell from "./menu-merge-cell" import MenuRemoveCol from "./menu-remove-col" import MenuRemoveRow from "./menu-remove-row" import MenuRemoveSheet from "./menu-remove-sheet" +import MenuDisabledAutoObi from "./menu-disabled-autoobi" +import MenuEnableAutoObi from "./menu-enable-autoobi" +import MenuSysDefaultAutoObi from "./menu-sysdefault-autoobi" /** @@ -22,7 +25,7 @@ class DDeiCoreMenus extends DDeiPluginBase{ plugins: object[] = [MenuCancelMergeCell, MenuCopySheet, MenuInsertCol, MenuInsertRow, - MenuMergeCell, MenuRemoveCol, MenuRemoveRow, MenuRemoveSheet] + MenuMergeCell, MenuRemoveCol, MenuRemoveRow, MenuRemoveSheet, MenuDisabledAutoObi, MenuEnableAutoObi, MenuSysDefaultAutoObi] getMenus(editor){ @@ -57,6 +60,6 @@ class DDeiCoreMenus extends DDeiPluginBase{ } export { DDeiCoreMenus, MenuCancelMergeCell, MenuCopySheet, MenuInsertCol, MenuInsertRow, - MenuMergeCell, MenuRemoveCol, MenuRemoveRow, MenuRemoveSheet + MenuMergeCell, MenuRemoveCol, MenuRemoveRow, MenuRemoveSheet, MenuDisabledAutoObi, MenuEnableAutoObi, MenuSysDefaultAutoObi } export default DDeiCoreMenus \ No newline at end of file diff --git a/plugins/core/menus/menu-disabled-autoobi.ts b/plugins/core/menus/menu-disabled-autoobi.ts new file mode 100644 index 0000000..10d362b --- /dev/null +++ b/plugins/core/menus/menu-disabled-autoobi.ts @@ -0,0 +1,81 @@ +import {DDeiEnumBusCommandType} from "ddei-framework"; +import {DDeiMenuBase} from "ddei-framework"; +/** + * 取消/开启 自动避障 + */ +class MenuDisabledAutoObi extends DDeiMenuBase { + + + name: string = "ddei-core-menu-disabled-auto-obi" + + + /** + * 缺省实例 + */ + static defaultIns: MenuDisabledAutoObi = new MenuDisabledAutoObi(); + + defaultOptions: object = { + 'label': 'ddei.disabledAutoObi', + 'disabled': false + } + + + + static configuration(options, fullConfig: boolean = false) { + //解析options,只使用自己相关的 + if (options) { + let newOptions = {} + if (fullConfig) { + if (fullConfig) { + if (options[MenuDisabledAutoObi.defaultIns.name]) { + for (let i in options[MenuDisabledAutoObi.defaultIns.name]) { + newOptions[i] = options[MenuDisabledAutoObi.defaultIns.name][i] + } + } + } + } else { + newOptions = options + } + if (newOptions && Object.keys(newOptions).length !== 0) { + let panels = new MenuDisabledAutoObi(newOptions); + return panels; + } + } + return MenuDisabledAutoObi; + } + + static modify(fn) { + return MenuDisabledAutoObi.defaultIns.modify(fn) + } + /** + * 执行的方法 + */ + action(model: object, evt: Event): void { + if (model?.baseModelType == 'DDeiLine') { + model.autoObiPolicy = 1 + let ddInstance = model.stage.ddInstance + + model.refreshLinePoints() + ddInstance.bus.push(DDeiEnumBusCommandType.RefreshShape); + ddInstance.bus.executeAll(); + + } + } + + /** + * 判定是否显示的方法 + */ + isVisiable(model: object): boolean { + //当前控件为表格控件,TODO 或者布局方式为表格的容器控件 + + if (!this.disabled && model?.baseModelType == 'DDeiLine' + && ((model.stage.ddInstance.GLOBAL_AUTO_OBI && !model.autoObiPolicy) || (!model.stage.ddInstance.GLOBAL_AUTO_OBI && model.autoObiPolicy == 2)) + ) { + return true + } + return false; + } + +} + +export default MenuDisabledAutoObi; diff --git a/plugins/core/menus/menu-enable-autoobi.ts b/plugins/core/menus/menu-enable-autoobi.ts new file mode 100644 index 0000000..fef3a64 --- /dev/null +++ b/plugins/core/menus/menu-enable-autoobi.ts @@ -0,0 +1,79 @@ +import {DDeiEnumBusCommandType} from "ddei-framework"; +import {DDeiMenuBase} from "ddei-framework"; +/** + * 取消/开启 自动避障 + */ +class MenuEnableAutoObi extends DDeiMenuBase { + + + name: string = "ddei-core-menu-enable-auto-obi" + + + /** + * 缺省实例 + */ + static defaultIns: MenuEnableAutoObi = new MenuEnableAutoObi(); + + defaultOptions: object = { + 'label': 'ddei.enableAutoObi', + 'disabled': false + } + + + + static configuration(options, fullConfig: boolean = false) { + //解析options,只使用自己相关的 + if (options) { + let newOptions = {} + if (fullConfig) { + if (fullConfig) { + if (options[MenuEnableAutoObi.defaultIns.name]) { + for (let i in options[MenuEnableAutoObi.defaultIns.name]) { + newOptions[i] = options[MenuEnableAutoObi.defaultIns.name][i] + } + } + } + } else { + newOptions = options + } + if (newOptions && Object.keys(newOptions).length !== 0) { + let panels = new MenuEnableAutoObi(newOptions); + return panels; + } + } + return MenuEnableAutoObi; + } + + static modify(fn) { + return MenuEnableAutoObi.defaultIns.modify(fn) + } + /** + * 执行的方法 + */ + action(model: object, evt: Event): void { + if (model?.baseModelType == 'DDeiLine') { + model.autoObiPolicy = 2 + let ddInstance = model.stage.ddInstance + + model.refreshLinePoints() + ddInstance.bus.push(DDeiEnumBusCommandType.RefreshShape); + ddInstance.bus.executeAll(); + + } + } + + /** + * 判定是否显示的方法 + */ + isVisiable(model: object): boolean { + //当前控件为表格控件,TODO 或者布局方式为表格的容器控件 + + if (!this.disabled && model?.baseModelType == 'DDeiLine' && ((model.stage.ddInstance.GLOBAL_AUTO_OBI && model.autoObiPolicy == 1) || (!model.stage.ddInstance.GLOBAL_AUTO_OBI && !model.autoObiPolicy))) { + return true + } + return false; + } + +} + +export default MenuEnableAutoObi; diff --git a/plugins/core/menus/menu-sysdefault-autoobi.ts b/plugins/core/menus/menu-sysdefault-autoobi.ts new file mode 100644 index 0000000..f948153 --- /dev/null +++ b/plugins/core/menus/menu-sysdefault-autoobi.ts @@ -0,0 +1,78 @@ +import {DDeiEnumBusCommandType} from "ddei-framework"; +import {DDeiMenuBase} from "ddei-framework"; +/** + * 采用系统避障策略 + */ +class MenuSysDefaultAutoObi extends DDeiMenuBase { + + + name: string = "ddei-core-menu-sysdefault-auto-obi" + + + /** + * 缺省实例 + */ + static defaultIns: MenuSysDefaultAutoObi = new MenuSysDefaultAutoObi(); + + defaultOptions: object = { + 'label': 'ddei.sysDefaultAutoObi', + 'disabled': false + } + + + + static configuration(options, fullConfig: boolean = false) { + //解析options,只使用自己相关的 + if (options) { + let newOptions = {} + if (fullConfig) { + if (fullConfig) { + if (options[MenuSysDefaultAutoObi.defaultIns.name]) { + for (let i in options[MenuSysDefaultAutoObi.defaultIns.name]) { + newOptions[i] = options[MenuSysDefaultAutoObi.defaultIns.name][i] + } + } + } + } else { + newOptions = options + } + if (newOptions && Object.keys(newOptions).length !== 0) { + let panels = new MenuSysDefaultAutoObi(newOptions); + return panels; + } + } + return MenuSysDefaultAutoObi; + } + + static modify(fn) { + return MenuSysDefaultAutoObi.defaultIns.modify(fn) + } + /** + * 执行的方法 + */ + action(model: object, evt: Event): void { + if (model?.baseModelType == 'DDeiLine') { + delete model.autoObiPolicy + let ddInstance = model.stage.ddInstance + + model.refreshLinePoints() + ddInstance.bus.push(DDeiEnumBusCommandType.RefreshShape); + ddInstance.bus.executeAll(); + + } + } + + /** + * 判定是否显示的方法 + */ + isVisiable(model: object): boolean { + if (!this.disabled && model?.baseModelType == 'DDeiLine' + && ((model.stage.ddInstance.GLOBAL_AUTO_OBI && model.autoObiPolicy == 2) || (!model.stage.ddInstance.GLOBAL_AUTO_OBI && model.autoObiPolicy == 1))) { + return true + } + return false; + } + +} + +export default MenuSysDefaultAutoObi; diff --git a/src/App.vue b/src/App.vue index 86acb0e..0fcbcc0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -28,7 +28,7 @@ export default defineComponent({ ] currentLayout = "ddei-core-layout-mobile" }else{ - exts = [DDeiExtTooltip, + exts = [ DDeiExtQuickStyle, DDeiCoreCanvasQuickDialog // .configuration({ @@ -43,6 +43,7 @@ export default defineComponent({ config: { ratio: 0.7, //默认缩放比例为120% pixel:2, //调整渲染质量 + // GLOBAL_AUTO_OBI:false, // readonly:true, // readonly:1, // paper:"A6", @@ -113,7 +114,7 @@ export default defineComponent({ other: ['ddei-core-panel-toolbox-simple', 'ddei-core-panel-topmenu-simple'], middle: ['ddei-core-panel-canvasview'], right: [], - bottom: [] + bottom: ['ddei-core-panel-bottommenu'] }), DDeiExtUML, DDeiExtSearch.modify((plugin)=>{ diff --git a/src/editor/Editor.vue b/src/editor/Editor.vue index a3abec0..9dbe2d5 100644 --- a/src/editor/Editor.vue +++ b/src/editor/Editor.vue @@ -119,6 +119,9 @@ export default { } loadControlDefineExt(oldControl) } + if (control.viewer) { + oldControl.viewer = control.viewer + } control = oldControl } this.editor.controls.set(control.id, control); @@ -157,16 +160,18 @@ export default { }) } + this.editor.controls?.forEach(control => { if (control.menus) { - if (!editorInstance.menuMapping[control.id]) { - editorInstance.menuMapping[control.id] = control.menus + + if (!this.editor.menuMapping[control.id]) { + this.editor.menuMapping[control.id] = control.menus } - let menus = editorInstance.menuMapping[control.id]; + let menus = this.editor.menuMapping[control.id]; for (let i = 0; i < menus.length; i++) { - for (let j in editorInstance.menus) { - if (editorInstance.menus[j].name == menus[i].name) { - menus[i] = editorInstance.menus[j]; + for (let j in this.editor.menus) { + if (this.editor.menus[j].name == menus[i].name) { + menus[i] = this.editor.menus[j]; break; } }