Skip to content

Commit b8a61b5

Browse files
committed
feat(QResizeObserver)/fix(QDrawer): Emmit immediately on QResizeObserver creation; Fix QLayout containerized right-side drawer position on a QDialog that gets reopened
1 parent f8eb114 commit b8a61b5

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

ui/src/components/layout/QDrawer.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export default Vue.extend({
104104
this.lastDesktopState !== false
105105
) { // from xs to lg
106106
if (this.showing === true) {
107+
this.__applyPosition(0)
107108
this.__applyBackdrop(0)
108109
this.__cleanup()
109110
}
@@ -337,7 +338,11 @@ export default Vue.extend({
337338
) {
338339
position += this.stateDirection * this.layout.scrollbarWidth
339340
}
340-
this.$refs.content.style.transform = `translateX(${position}px)`
341+
342+
if (this.__lastPosition !== position) {
343+
this.$refs.content.style.transform = `translateX(${position}px)`
344+
this.__lastPosition = position
345+
}
341346
}
342347
},
343348

ui/src/components/observer/QResizeObserver.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ export default Vue.extend({
1111

1212
props: {
1313
debounce: {
14-
type: [String, Number],
14+
type: [ String, Number ],
1515
default: 100
1616
}
1717
},
1818

1919
data () {
20-
return this.hasObserver
20+
return this.hasObserver === true
2121
? {}
22-
: { url: this.$q.platform.is.ie ? null : 'about:blank' }
22+
: { url: this.$q.platform.is.ie === true ? null : 'about:blank' }
2323
},
2424

2525
methods: {
26-
trigger (immediately) {
27-
if (immediately === true || this.debounce === 0 || this.debounce === '0') {
26+
trigger (now) {
27+
if (now === true || this.debounce === 0 || this.debounce === '0') {
2828
this.__onResize()
2929
}
3030
else if (!this.timer) {
@@ -72,7 +72,7 @@ export default Vue.extend({
7272
this.curDocView.addEventListener('resize', this.trigger, listenOpts.passive)
7373
}
7474

75-
this.trigger(true)
75+
this.__onResize()
7676
}
7777
},
7878

@@ -110,12 +110,13 @@ export default Vue.extend({
110110
if (this.hasObserver === true) {
111111
this.observer = new ResizeObserver(this.trigger)
112112
this.observer.observe(this.$el.parentNode)
113+
this.__onResize()
113114
return
114115
}
115116

116-
if (this.$q.platform.is.ie) {
117+
if (this.$q.platform.is.ie === true) {
117118
this.url = 'about:blank'
118-
this.trigger(true)
119+
this.__onResize()
119120
}
120121
else {
121122
this.__onObjLoad()

0 commit comments

Comments
 (0)