From e9e5f68e41d67174914390efa5df1ef654c63a63 Mon Sep 17 00:00:00 2001 From: YuanFeng <770153798@qq.com> Date: Thu, 24 Oct 2024 22:40:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E7=A8=BF=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E9=A2=9C=E8=89=B2=E5=A4=B1=E6=95=88=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/DraftDesign/config/index.ts | 2 +- .../src/components/DraftDesign/index.vue | 35 ++++++++++--------- .../components/DraftDesign/config/index.ts | 2 +- .../src/components/DraftDesign/index.vue | 35 ++++++++++--------- 4 files changed, 40 insertions(+), 34 deletions(-) diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/config/index.ts b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/config/index.ts index a487301..617a2a6 100644 --- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/config/index.ts +++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/config/index.ts @@ -91,7 +91,7 @@ export const graphOptions = (elId:string, viewMode = false) => { }, panning: { // 画布移动 - enabled: viewMode, + enabled: false, pageVisible: false, // 是否分页 pageBreak: true, pannable: true,// 是否平移 diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue index c4ccc90..866ed47 100644 --- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue +++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue @@ -481,21 +481,21 @@ const init = (isDesignMode: boolean, bgConfig: any, data = {}, propDataInfo = {} height: maxSize, } graph = new Graph(options) + // 画布拖动组件 + graph.use( + new Scroller({ + enabled: true, + pageVisible: true, // 是否分页 + pageBreak: false, + pannable: true,// 是否平移 + // pageWidth: that.pageConfig.editArea.width * 10, + // pageHeight: that.pageConfig.editArea.height * 10, + // modifiers: ['ctrl', 'meta'], + }), + ) if (that.editState) { - // 画布拖动组件 - graph.use( - new Scroller({ - enabled: true, - pageVisible: true, // 是否分页 - pageBreak: false, - pannable: true,// 是否平移 - // pageWidth: that.pageConfig.editArea.width * 10, - // pageHeight: that.pageConfig.editArea.height * 10, - // modifiers: ['ctrl', 'meta'], - }), - ) // 参考线 graph.use( @@ -974,9 +974,9 @@ const getDeviceDPI = () => { } let rulerContainer = document.createElement('div'); const addDrawRuler = () => { - if(!that.editState){ - return; - } + // if(!that.editState){ + // return; + // } // 计算每个像素对应的毫米数 const dpi = getDeviceDPI(); const mmPerInch = 25.4; // 1 英寸 = 25.4 毫米 @@ -1004,7 +1004,10 @@ const addDrawRuler = () => { backgroundCanvas.style.left = '0px'; // 与顶部标尺对齐 backgroundCanvas.style.zIndex = '-1'; // 置底 backgroundCanvas.style.backgroundColor = that.pageConfig.background.areaColor - backgroundCanvas.style.boxShadow = `1px 1px 2px 2px rgb(0, 255, 0)`; + if(that.editState) { + backgroundCanvas.style.boxShadow = `1px 1px 2px 2px rgb(0, 255, 0)`; + } + backgroundCanvas.style.pointerEvents = 'none'; rulerContainer.appendChild(backgroundCanvas); if (that.editState) { diff --git a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/config/index.ts b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/config/index.ts index a487301..617a2a6 100644 --- a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/config/index.ts +++ b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/config/index.ts @@ -91,7 +91,7 @@ export const graphOptions = (elId:string, viewMode = false) => { }, panning: { // 画布移动 - enabled: viewMode, + enabled: false, pageVisible: false, // 是否分页 pageBreak: true, pannable: true,// 是否平移 diff --git a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/index.vue b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/index.vue index c4ccc90..866ed47 100644 --- a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/index.vue +++ b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/index.vue @@ -481,21 +481,21 @@ const init = (isDesignMode: boolean, bgConfig: any, data = {}, propDataInfo = {} height: maxSize, } graph = new Graph(options) + // 画布拖动组件 + graph.use( + new Scroller({ + enabled: true, + pageVisible: true, // 是否分页 + pageBreak: false, + pannable: true,// 是否平移 + // pageWidth: that.pageConfig.editArea.width * 10, + // pageHeight: that.pageConfig.editArea.height * 10, + // modifiers: ['ctrl', 'meta'], + }), + ) if (that.editState) { - // 画布拖动组件 - graph.use( - new Scroller({ - enabled: true, - pageVisible: true, // 是否分页 - pageBreak: false, - pannable: true,// 是否平移 - // pageWidth: that.pageConfig.editArea.width * 10, - // pageHeight: that.pageConfig.editArea.height * 10, - // modifiers: ['ctrl', 'meta'], - }), - ) // 参考线 graph.use( @@ -974,9 +974,9 @@ const getDeviceDPI = () => { } let rulerContainer = document.createElement('div'); const addDrawRuler = () => { - if(!that.editState){ - return; - } + // if(!that.editState){ + // return; + // } // 计算每个像素对应的毫米数 const dpi = getDeviceDPI(); const mmPerInch = 25.4; // 1 英寸 = 25.4 毫米 @@ -1004,7 +1004,10 @@ const addDrawRuler = () => { backgroundCanvas.style.left = '0px'; // 与顶部标尺对齐 backgroundCanvas.style.zIndex = '-1'; // 置底 backgroundCanvas.style.backgroundColor = that.pageConfig.background.areaColor - backgroundCanvas.style.boxShadow = `1px 1px 2px 2px rgb(0, 255, 0)`; + if(that.editState) { + backgroundCanvas.style.boxShadow = `1px 1px 2px 2px rgb(0, 255, 0)`; + } + backgroundCanvas.style.pointerEvents = 'none'; rulerContainer.appendChild(backgroundCanvas); if (that.editState) {