|
|
@ -64,30 +64,7 @@ export class Popover extends Widget { |
|
|
|
// var self = this;
|
|
|
|
// var self = this;
|
|
|
|
const { header, headerHeight, closable, logic, footer, footerHeight, body, bodyTgap, bodyHgap } = this.options; |
|
|
|
const { header, headerHeight, closable, logic, footer, footerHeight, body, bodyTgap, bodyHgap } = this.options; |
|
|
|
const c = this._constant; |
|
|
|
const c = this._constant; |
|
|
|
this.startX = 0; |
|
|
|
|
|
|
|
this.startY = 0; |
|
|
|
|
|
|
|
const size = this._calculateSize(); |
|
|
|
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 = [ |
|
|
|
const items = [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
el: { |
|
|
|
el: { |
|
|
@ -219,7 +196,30 @@ export class Popover extends Widget { |
|
|
|
|
|
|
|
|
|
|
|
// mounted之后绑定事件
|
|
|
|
// mounted之后绑定事件
|
|
|
|
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) { |
|
|
|
if (this.options.draggable !== false) { |
|
|
|
this.startX = this.element[0].offsetLeft; |
|
|
|
this.startX = this.element[0].offsetLeft; |
|
|
|
this.startY = this.element[0].offsetTop; |
|
|
|
this.startY = this.element[0].offsetTop; |
|
|
|