From a3d0e53dee5efa6794e765e54d0c89fd2ed5e05f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B9=A6=E6=9F=B1?= Date: Fri, 29 Apr 2022 03:48:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=97=8B=E8=BD=AC=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E7=BC=A9=E6=94=BE=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hiprint/hiprint.bundle.js | 123 ++++++++++++++++++++++------------ 1 file changed, 79 insertions(+), 44 deletions(-) diff --git a/src/hiprint/hiprint.bundle.js b/src/hiprint/hiprint.bundle.js index 9da723c..5b7c3b1 100644 --- a/src/hiprint/hiprint.bundle.js +++ b/src/hiprint/hiprint.bundle.js @@ -1244,7 +1244,11 @@ var hiprint = function (t) { onBeforeDrag: function onBeforeDrag(t) { _HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.draging = !0, n.designTarget.focus(), n.createLineOfPosition(e); }, + getScale:function getScale (){ + return n.designPaper.scale||1 + }, onStopDrag: function onStopDrag(t) { + //普通元素拖动结束事件history _HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.draging = !1, n.removeLineOfPosition(); } }), this.designTarget.hireizeable({ @@ -1266,6 +1270,7 @@ var hiprint = function (t) { }, BasePrintElement.prototype.getPrintElementEntity = function (t) { return t ? new _entity_PrintElementEntity__WEBPACK_IMPORTED_MODULE_0__.a(void 0, this.options.getPrintElementOptionEntity(), this.printElementType.getPrintElementTypeEntity()) : new _entity_PrintElementEntity__WEBPACK_IMPORTED_MODULE_0__.a(this.printElementType.tid, this.options.getPrintElementOptionEntity()); }, BasePrintElement.prototype.submitOption = function () { + // 右侧选项修改模版数据触发history var t = this; this.getPrintElementOptionItems().forEach(function (e) { var n = e.getValue(); @@ -1279,7 +1284,8 @@ var hiprint = function (t) { this.options.setRotate(r), _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_4__.a.event.trigger("hiprintTemplateDataChanged_" + this.templateId); }, BasePrintElement.prototype.onResize = function (t, e, n, i, o) { this.updateSizeAndPositionOptions(o, i, n, e); - }, BasePrintElement.prototype.getOrderIndex = function () { + }, + BasePrintElement.prototype.getOrderIndex = function () { return this.options.getTop(); }, BasePrintElement.prototype.getHtml = function (t, e, n) { var i = 0; @@ -1710,8 +1716,6 @@ var hiprint = function (t) { return this.title; }, t.prototype.beginEdit = function (t) { var e = this; - console.log(t) - console.log(e) if (e.tableOptions.options.fields && e.tableOptions.options.fields.length) { this.editor = r.Instance.createSelect("select"), t.getTarget().html(""), this.editor.init(e.tableOptions.options.fields, t), this.editor.setValue(this.field || ""), $(this.editor.target).keydown(function (n) { 13 == n.keyCode && e.endEdit(t); @@ -3820,7 +3824,8 @@ var hiprint = function (t) { return t.init(), t.printElementOptionItems[e]; }, t._printElementOptionItems = [new o(), new r(), new a(), new p(), new i(), new s(), new l(), new pt(), new u(), new d(), new c(), new h(), new f(), new g(), new m(), new v(), new y(), new b(), new E(), new T(), new P(), new _(), new w(), new x(), new C(), new O(), new H(), new D(), new I(), new R(), new M(), new M2(), new S(), new B(), new F(), new L(), new A(), new z(), new k(), new st(), new N(), new V(), new W(), new j(), new U(), new K(), new G(), new q(), new X(), new Y(), new Q(), new J(), new Z(), new tt(), new et(), new nt(), new it(), new ot(), new at(), new lt(), new ut(), new it(), new dt(), new ct(), new ht(), new ft(), new gt(), new mt(), new vt(), new yt(), new bt(), new Tt(), new Et(), new Pt(), new _t(), new wt(), new xt(),new tableColumnH(),new tableE(),new tablept()], t; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -3897,7 +3902,8 @@ var hiprint = function (t) { this.rowIndex = t, this.cell = e; }; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -3912,7 +3918,8 @@ var hiprint = function (t) { return this.id += 1, this.id; }, t.id = 1, t; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -3957,7 +3964,8 @@ var hiprint = function (t) { }), t; }, e; }(r.a); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -4006,7 +4014,8 @@ var hiprint = function (t) { }), t; }, t; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -4036,7 +4045,8 @@ var hiprint = function (t) { }; }, t; }(); -}, function (module, __webpack_exports__, __webpack_require__) { +}, +function (module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.d(__webpack_exports__, "a", function () { @@ -4297,6 +4307,9 @@ var hiprint = function (t) { onBeforeDrag: function onBeforeDrag(t) { _HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.draging = !0, n.createLineOfPosition(e); }, + getScale:function getScale (){ + return n.designPaper.scale||1 + }, onStopDrag: function onStopDrag(t) { _HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.draging = !1, n.removeLineOfPosition(); } @@ -4392,7 +4405,8 @@ var hiprint = function (t) { return gridColumnsFooterFormatter; }, TablePrintElement; }(_BasePrintElement__WEBPACK_IMPORTED_MODULE_0__.a); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; var i = function () { @@ -4990,7 +5004,8 @@ var hiprint = function (t) { this.resizer.updateRowGrips(); }, t; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -5002,7 +5017,8 @@ var hiprint = function (t) { this.tid = t, this.options = e, this.printElementType = n; }; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; var i = n(3), @@ -5079,7 +5095,8 @@ var hiprint = function (t) { })), e; }, e; }(i.a); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -5091,7 +5108,8 @@ var hiprint = function (t) { this.rowColumns = []; }; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -5107,18 +5125,23 @@ var hiprint = function (t) { return this.target.find(".hi-grid-col:eq(" + t + ")"); }, t; }(); -}, function (t, e, n) { +}, +function (t, e, n) { t.exports = n(33); -}, function (t, e) { +}, +function (t, e) { !function (t) { function e(e) { + var n = t.data(e.data.target, "hidraggable"), i = n.options, o = n.proxy, r = e.data, - a = r.startLeft + e.pageX - r.startX, - p = r.startTop + e.pageY - r.startY; + a = r.startLeft + (e.pageX - r.startX) / n.options.getScale() , + p = r.startTop + (e.pageY - r.startY) / n.options.getScale() ; o && (o.parent()[0] == document.body ? (a = null != i.deltaX && null != i.deltaX ? e.pageX + i.deltaX : e.pageX - e.data.offsetWidth, p = null != i.deltaY && null != i.deltaY ? e.pageY + i.deltaY : e.pageY - e.data.offsetHeight) : (null != i.deltaX && null != i.deltaX && (a += e.data.offsetWidth + i.deltaX), null != i.deltaY && null != i.deltaY && (p += e.data.offsetHeight + i.deltaY))), e.data.parent != document.body && (a += t(e.data.parent).scrollLeft(), p += t(e.data.parent).scrollTop()), "h" == i.axis ? r.left = a : "v" == i.axis ? r.top = p : (r.left = a, r.top = p); + + } function n(e) { @@ -5149,6 +5172,7 @@ var hiprint = function (t) { } function o(i) { + // 移动开始动作 var o = t.data(i.data.target, "hidraggable"); e(i); if (i.data.target.className.startsWith('resize-panel') || i.data.target.className.startsWith('hiprint-printElement')) { @@ -5269,7 +5293,6 @@ var hiprint = function (t) { u = e.pageX - o.left; return Math.min(p, s, l, u) > n.options.edge; } - t.data(this, "hidraggable", { options: n, handle: p @@ -5287,6 +5310,7 @@ var hiprint = function (t) { }).bind("mousedown.hidraggable", { target: this }, function (e) { + var ops = t.data(e.data.target, "hidraggable") if (0 != s(e)) { t(this).css("cursor", ""); var n = t(e.data.target).position(), @@ -5304,22 +5328,23 @@ var hiprint = function (t) { target: e.data.target, parent: t(e.data.target).parent()[0] }; - var tr = p.target.style.transform && parseInt(p.target.style.transform.slice(7,-1)); - if (tr) { - var rad = tr * Math.PI / 180, - width = t(e.data.target).outerWidth(), - height = t(e.data.target).outerHeight(), - sin = Math.sin(rad), - cos = Math.cos(rad); - var w = Math.abs(width * cos) + Math.abs(height * sin), - h = Math.abs(width * sin) + Math.abs(height * cos); - var diffW = (w - width) / 2, diffH = (h - height) / 2; - p.left += diffW, p.top += diffH, p.startLeft += diffW, p.startTop += diffH; - } - var ptr = t('.hiprint-printPaper')[0].style.transform && parseFloat(t('.hiprint-printPaper')[0].style.transform.slice(6,-1)); - if (ptr) { - p.left /= ptr, p.top /= ptr, p.startLeft /= ptr, p.startTop /= ptr; - } + + var ptr = ops.options.getScale() + if (ptr) { + p.left /= ptr, p.top /= ptr, p.startLeft /= ptr, p.startTop /= ptr; + } + var tr = p.target.style.transform && parseInt(p.target.style.transform.slice(7,-1)); + if (tr) { + var rad = tr * Math.PI / 180, + width = t(e.data.target).outerWidth(), + height = t(e.data.target).outerHeight(), + sin = Math.sin(rad), + cos = Math.cos(rad); + var w = Math.abs(width * cos) + Math.abs(height * sin), + h = Math.abs(width * sin) + Math.abs(height * cos); + var diffW = (w - width) / 2, diffH = (h - height) / 2; + p.left += diffW, p.top += diffH, p.startLeft += diffW, p.startTop += diffH; + } t.extend(e.data, p); // 旋转时不允许移动 if ('r resizebtn' == e.target.className) { @@ -5370,6 +5395,7 @@ var hiprint = function (t) { disabled: !1, edge: 0, axis: null, + getScale:function getScale(t){}, onBeforeDrag: function onBeforeDrag(t) { }, onStartDrag: function onStartDrag(t) { @@ -5651,16 +5677,19 @@ var hiprint = function (t) { } else if (rt) { t.css({ height: "100%" }); var eo = e.pageX, er = e.pageY; - var AB = {}, AC = {}; - AB.X = o - s, AB.Y = r - l, AC.X = eo - s, AC.Y = er - l; - var direct = (AB.X * AC.Y) - (AB.Y * AC.X); - var lAB = Math.sqrt(Math.pow(s - o, 2) + Math.pow(l - r, 2)), - lAC = Math.sqrt(Math.pow(s - eo, 2) + Math.pow(l - er, 2)), - lBC = Math.sqrt(Math.pow(o - eo, 2) + Math.pow(r - er, 2)); - var cosA = (Math.pow(lAB, 2) + Math.pow(lAC, 2) - Math.pow(lBC, 2)) / (2 * lAB * lAC); - var angle = Math.round(Math.acos(cosA) * 180 / Math.PI); + var direct = (eo - o) * 360 / 100; + o = e.pageX + // var AB = {}, AC = {}; + // AB.X = o - s, AB.Y = r - l, AC.X = eo - s, AC.Y = er - l; + // var direct = (AB.X * AC.Y) - (AB.Y * AC.X); + // var lAB = Math.sqrt(Math.pow(s - o, 2) + Math.pow(l - r, 2)), + // lAC = Math.sqrt(Math.pow(s - eo, 2) + Math.pow(l - er, 2)), + // lBC = Math.sqrt(Math.pow(o - eo, 2) + Math.pow(r - er, 2)); + // var cosA = (Math.pow(lAB, 2) + Math.pow(lAC, 2) - Math.pow(lBC, 2)) / (2 * lAB * lAC); + // var angle = Math.round(Math.acos(cosA) * 180 / Math.PI); var lastAngle = (u[0].style.transform && parseInt(u[0].style.transform.slice(7,-1))) || 0; - var R = lastAngle + (direct > 0 ? angle : -angle); + // var R = lastAngle + (direct > 0 ? angle : -angle); + var R = lastAngle + direct ; if (Math.abs(R) > 360) { R = R % 360 } @@ -6484,6 +6513,9 @@ var hiprint = function (t) { onBeforeDrag: function onBeforeDrag(t) { s.a.instance.draging = !0; }, + getScale:function getScale (){ + return i.scale||1 + }, onStopDrag: function onStopDrag(t) { s.a.instance.draging = !1, i.footerLinetarget.removeClass("hidefooterLinetarget"), i.headerLinetarget.removeClass("hideheaderLinetarget"); } @@ -7872,6 +7904,9 @@ var hiprint = function (t) { onBeforeDrag: function onBeforeDrag(t) { e.mouseRect.target.focus(), s.a.instance.draging = !0, e.mouseRect.mouseRectSelectedElement || (e.mouseRect.mouseRectSelectedElement = e.getElementInRect(e.mouseRect)); }, + getScale:function getScale (){ + return e.designPaper.scale||1 + }, onStopDrag: function onStopDrag(t) { s.a.instance.draging = !1; } -- Gitee From 3374e98e7e6db859ebd5a90eec9b9ccadb0f9e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B9=A6=E6=9F=B1?= Date: Fri, 29 Apr 2022 12:01:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BC=A9=E6=94=BE=E5=90=8E=E5=AE=BD?= =?UTF-8?q?=E9=AB=98=E6=8B=96=E5=8A=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hiprint/hiprint.bundle.js | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/hiprint/hiprint.bundle.js b/src/hiprint/hiprint.bundle.js index 5b7c3b1..86925fc 100644 --- a/src/hiprint/hiprint.bundle.js +++ b/src/hiprint/hiprint.bundle.js @@ -1253,6 +1253,9 @@ var hiprint = function (t) { } }), this.designTarget.hireizeable({ showPoints: n.getReizeableShowPoints(), + getScale:function getScale (){ + return n.designPaper.scale||1 + }, onBeforeResize: function onBeforeResize() { _HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.draging = !0; }, @@ -4319,6 +4322,9 @@ function (module, __webpack_exports__, __webpack_require__) { onBeforeResize: function onBeforeResize() { _HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.draging = !0; }, + getScale:function getScale (){ + return n.designPaper.scale||1 + }, onResize: function onResize(t, i, o, r, a) { n.onResize(t, i, o, r, a), n.hitable && n.hitable.updateColumnGrips(), n.createLineOfPosition(e); }, @@ -4534,6 +4540,10 @@ function (t, e, n) { if (g.a.instance.draging = !0, !s.nextGrip) return !1; e.dragingGrip = s, e.dragingGrip.left = parseFloat(e.dragingGrip.target.css("left").replace("px", "")), s.target.addClass("columngripDraging"); }, + getScale:function getScale (){ + // 待群主大大修复 返回scale属性 + return 1 + }, onStopDrag: function onStopDrag(n) { g.a.instance.draging = !1; var i = parseFloat(e.dragingGrip.target.css("left").replace("px", "")), @@ -5660,15 +5670,16 @@ function (t, e) { t.on("mousedown", function (t) { i.options.onBeforeResize(), o = t.pageX, r = t.pageY, l = u.offset().top, s = u.offset().left, b = !1; }), n(i.options.stage).on("mousemove", function (e) { + console.log(i.options.getScale()) if (d) { - var n = e.pageX - o; + var n = (e.pageX - o) / i.options.getScale(); t.css({ width: "100%" }), u.css({ width: i.numHandlerText(a + n) }), i.options.onResize(e, void 0, i.numHandler(a + n), void 0, void 0); } else if (c) { - var E = e.pageY - r; + var E = (e.pageY - r) / i.options.getScale(); t.css({ height: "100%" }), u.css({ @@ -5695,24 +5706,24 @@ function (t, e) { } u.css({ transform: "rotate(" + R + "deg)" }); i.options.onResize(e, void 0, void 0, void 0, void 0, R); - } else h ? (n = e.pageX - o, t.css({ + } else h ? (n = (e.pageX - o) / i.options.getScale(), t.css({ width: "100%" }), u.css({ width: i.numHandlerText(a - n), left: i.numHandlerText(i.options.noDrag ? void 0 : i.numHandler(s + n)) - }), i.options.onResize(e, void 0, i.numHandler(a - n), void 0, i.options.noDrag ? void 0 : i.numHandler(s + n))) : f ? (E = e.pageY - r, t.css({ + }), i.options.onResize(e, void 0, i.numHandler(a - n), void 0, i.options.noDrag ? void 0 : i.numHandler(s + n))) : f ? (E = (e.pageY - r) / i.options.getScale(), t.css({ height: "100%" }), u.css({ height: i.numHandlerText(p - E), top: i.numHandlerText(i.options.noDrag ? void 0 : l + E) - }), i.options.onResize(e, i.numHandler(p - E), void 0, i.options.noDrag ? void 0 : i.numHandler(l + E), void 0)) : g ? (n = e.pageX - o, E = e.pageY - r, t.css({ + }), i.options.onResize(e, i.numHandler(p - E), void 0, i.options.noDrag ? void 0 : i.numHandler(l + E), void 0)) : g ? (n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), t.css({ height: "100%", width: "100%" }), u.css({ height: i.numHandlerText(p - E), top: i.numHandlerText(i.options.noDrag ? void 0 : l + E), width: i.numHandlerText(a + n) - }), i.options.onResize(e, i.numHandler(p - E), i.numHandler(a + n), i.options.noDrag ? void 0 : i.numHandler(l + E), void 0)) : m ? (n = e.pageX - o, E = e.pageY - r, t.css({ + }), i.options.onResize(e, i.numHandler(p - E), i.numHandler(a + n), i.options.noDrag ? void 0 : i.numHandler(l + E), void 0)) : m ? (n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), t.css({ height: "100%", width: "100%" }), u.css({ @@ -5720,20 +5731,20 @@ function (t, e) { top: i.numHandlerText(i.options.noDrag ? void 0 : l + E), width: i.numHandlerText(a - n), left: i.numHandlerText(i.options.noDrag ? void 0 : s + n) - }), i.options.onResize(e, i.numHandler(p - E), i.numHandler(a - n), i.options.noDrag ? void 0 : i.numHandler(l + E), i.options.noDrag ? void 0 : i.numHandler(s + n))) : v ? (n = e.pageX - o, E = e.pageY - r, t.css({ + }), i.options.onResize(e, i.numHandler(p - E), i.numHandler(a - n), i.options.noDrag ? void 0 : i.numHandler(l + E), i.options.noDrag ? void 0 : i.numHandler(s + n))) : v ? (n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), t.css({ width: "100%", height: "100%" }), u.css({ width: i.numHandlerText(a + n), height: i.numHandlerText(p + E) - }), i.options.onResize(e, i.numHandler(p + E), i.numHandler(a + n), void 0, void 0)) : y ? (n = e.pageX - o, E = e.pageY - r, t.css({ + }), i.options.onResize(e, i.numHandler(p + E), i.numHandler(a + n), void 0, void 0)) : y ? (n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), t.css({ width: "100%", height: "100%" }), u.css({ width: i.numHandlerText(a - n), left: i.numHandlerText(i.options.noDrag ? void 0 : s + n), height: i.numHandlerText(p + E) - }), i.options.onResize(e, i.numHandler(p + E), i.numHandler(a - n), i.numHandler(otundefinedop), i.options.noDrag ? void 0 : i.numHandler(s + n))) : b && (n = e.pageX - o, E = e.pageY - r, u.css({ + }), i.options.onResize(e, i.numHandler(p + E), i.numHandler(a - n), i.numHandler(otundefinedop), i.options.noDrag ? void 0 : i.numHandler(s + n))) : b && (n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), u.css({ left: i.numHandlerText(i.options.noDrag ? void 0 : s + n), top: i.numHandlerText(i.options.noDrag ? void 0 : l + E) }), i.options.onResize(e, void 0, void 0, i.options.noDrag ? void 0 : i.numHandler(l + E), i.options.noDrag ? void 0 : i.numHandler(s + n))); @@ -7406,6 +7417,9 @@ function (t, e) { onBeforeResize: function onBeforeResize() { s.a.instance.draging = !0; }, + getScale:function getScale (){ + return n.designPaper.scale||1 + }, onResize: function onResize(t, i, o, r, a) { n.onResize(t, i, o, r, a), n.hitable.updateColumnGrips(), n.createLineOfPosition(e); }, -- Gitee