|
@@ -88,6 +88,9 @@ export default {
|
|
|
this.currentScale = this.getRealScale();
|
|
this.currentScale = this.getRealScale();
|
|
|
this.w = this._parseSize(this.defaultWidth, window.innerWidth);
|
|
this.w = this._parseSize(this.defaultWidth, window.innerWidth);
|
|
|
this.h = this._parseSize(this.defaultHeight, window.innerHeight);
|
|
this.h = this._parseSize(this.defaultHeight, window.innerHeight);
|
|
|
|
|
+ // 记录上次窗口尺寸,用于区分"真实 resize"与"合成 resize"(如 openDialog 广播)
|
|
|
|
|
+ this._lastWinW = window.innerWidth;
|
|
|
|
|
+ this._lastWinH = window.innerHeight;
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
window.addEventListener('resize', this._onWindowResize);
|
|
window.addEventListener('resize', this._onWindowResize);
|
|
@@ -149,6 +152,14 @@ export default {
|
|
|
|
|
|
|
|
_onWindowResize() {
|
|
_onWindowResize() {
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
|
|
+ // 仅在窗口尺寸真正变化时才重算/夹取位置。
|
|
|
|
|
+ // openDialog 等会派发"合成 resize"(尺寸未变),此时不应把已被用户拖动的弹窗强行拉回视口内。
|
|
|
|
|
+ if (window.innerWidth === this._lastWinW && window.innerHeight === this._lastWinH) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this._lastWinW = window.innerWidth;
|
|
|
|
|
+ this._lastWinH = window.innerHeight;
|
|
|
|
|
+
|
|
|
// 重新获取当前最新比例
|
|
// 重新获取当前最新比例
|
|
|
const newScale = this.getRealScale();
|
|
const newScale = this.getRealScale();
|
|
|
const scaleRatio = newScale / this.currentScale;
|
|
const scaleRatio = newScale / this.currentScale;
|