From 813e72756b213167f77feb99d9f10b15207e059a Mon Sep 17 00:00:00 2001 From: jian Date: Tue, 2 Jan 2024 15:01:31 +0800 Subject: [PATCH] =?UTF-8?q?BI-137665=20fix:=20=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fineui/src/base/layer/layer.popover.js | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/fineui/src/base/layer/layer.popover.js b/packages/fineui/src/base/layer/layer.popover.js index ea6db3662..50e99a60e 100644 --- a/packages/fineui/src/base/layer/layer.popover.js +++ b/packages/fineui/src/base/layer/layer.popover.js @@ -64,30 +64,7 @@ export class Popover extends Widget { // var self = this; const { header, headerHeight, closable, logic, footer, footerHeight, body, bodyTgap, bodyHgap } = this.options; const c = this._constant; - this.startX = 0; - this.startY = 0; const size = this._calculateSize(); - const bodyDom = getOuterBody(); - this.tracker = new MouseMoveTracker( - (deltaX, deltaY) => { - const W = Widget._renderEngine.createElement(bodyDom).width(); - const H = Widget._renderEngine.createElement(bodyDom).height(); - this.startX += deltaX; - this.startY += deltaY; - this.element.css({ - left: `${clamp(this.startX, 0, W - this.element.width())}px`, - top: `${clamp(this.startY, 0, H - this.element.height())}px`, - }); - // BI-12134 没有什么特别好的方法 - Resizers._resize({ - target: this.element[0], - }); - }, - () => { - this.tracker.releaseMouseMoves(); - }, - _global - ); const items = [ { el: { @@ -219,7 +196,30 @@ export class Popover extends Widget { // mounted之后绑定事件 mounted() { - this.dragger.element.mousedown(e => { + this.startX = 0; + this.startY = 0; + const bodyDom = getOuterBody(); + this.tracker = new MouseMoveTracker( + (deltaX, deltaY) => { + const W = Widget._renderEngine.createElement(bodyDom).width(); + const H = Widget._renderEngine.createElement(bodyDom).height(); + this.startX += deltaX; + this.startY += deltaY; + this.element.css({ + left: `${clamp(this.startX, 0, W - this.element.width())}px`, + top: `${clamp(this.startY, 0, H - this.element.height())}px`, + }); + // BI-12134 没有什么特别好的方法 + Resizers._resize({ + target: this.element[0], + }); + }, + () => { + this.tracker.releaseMouseMoves(); + }, + _global + ); + this.dragger?.element.mousedown(e => { if (this.options.draggable !== false) { this.startX = this.element[0].offsetLeft; this.startY = this.element[0].offsetTop;