Modal support fullscreen and draggable

This commit is contained in:
梁灏 2021-09-07 11:09:41 +08:00
parent 5718735198
commit d8d1bcb92b

View file

@ -199,7 +199,7 @@
`${prefixCls}-content`, `${prefixCls}-content`,
{ {
[`${prefixCls}-content-no-mask`]: !this.showMask, [`${prefixCls}-content-no-mask`]: !this.showMask,
[`${prefixCls}-content-drag`]: this.draggable, [`${prefixCls}-content-drag`]: this.draggable && !this.fullscreen,
[`${prefixCls}-content-dragging`]: this.draggable && this.dragData.dragging [`${prefixCls}-content-dragging`]: this.draggable && this.dragData.dragging
} }
]; ];
@ -223,7 +223,7 @@
contentStyles () { contentStyles () {
let style = {}; let style = {};
if (this.draggable) { if (this.draggable && !this.fullscreen) {
const customTop = this.styles.top ? parseFloat(this.styles.top) : 0; const customTop = this.styles.top ? parseFloat(this.styles.top) : 0;
const customLeft = this.styles.left ? parseFloat(this.styles.left) : 0; const customLeft = this.styles.left ? parseFloat(this.styles.left) : 0;
if (this.dragData.x !== null) style.left = `${this.dragData.x - customLeft}px`; if (this.dragData.x !== null) style.left = `${this.dragData.x - customLeft}px`;
@ -327,7 +327,7 @@
this.$emit('on-hidden'); this.$emit('on-hidden');
}, },
handleMoveStart (event) { handleMoveStart (event) {
if (!this.draggable) return false; if (!this.draggable || this.fullscreen) return false;
const $content = this.$refs.content; const $content = this.$refs.content;
const rect = $content.getBoundingClientRect(); const rect = $content.getBoundingClientRect();
@ -350,7 +350,7 @@
on(window, 'mouseup', this.handleMoveEnd); on(window, 'mouseup', this.handleMoveEnd);
}, },
handleMoveMove (event) { handleMoveMove (event) {
if (!this.dragData.dragging) return false; if (!this.dragData.dragging || this.fullscreen) return false;
const distance = { const distance = {
x: event.clientX, x: event.clientX,