Skip to content

Commit 38262df

Browse files
committed
perf(QMenu): improve show() logic quasarframework#5110 quasarframework#5108
1 parent 4d09346 commit 38262df

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

ui/src/components/menu/QMenu.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,15 @@ export default Vue.extend({
119119
this.__showPortal()
120120
this.__configureScrollTarget()
121121

122-
const { top, left } = this.anchorEl.getBoundingClientRect()
123-
124-
if (
125-
evt !== void 0 &&
126-
evt.clientX !== void 0 &&
127-
evt.clientY !== void 0 &&
128-
(this.touchPosition || this.contextMenu)
129-
) {
122+
this.absoluteOffset = void 0
123+
124+
if (evt !== void 0 && (this.touchPosition || this.contextMenu)) {
130125
const pos = position(evt)
131-
this.absoluteOffset = { left: pos.left - left, top: pos.top - top }
132-
}
133-
else {
134-
this.absoluteOffset = void 0
126+
127+
if (pos.left !== void 0) {
128+
const { top, left } = this.anchorEl.getBoundingClientRect()
129+
this.absoluteOffset = { left: pos.left - left, top: pos.top - top }
130+
}
135131
}
136132

137133
if (this.unwatch === void 0) {

0 commit comments

Comments
 (0)