@@ -41,25 +41,28 @@ Popup {
41
41
42
42
onAboutToShow: {
43
43
// Panel defaults to dropping to the right of click position
44
- _root . x = clickRect .x + clickRect .width
44
+ let xPos = clickRect .x + clickRect .width
45
45
46
46
// If there isn't room to the right then we switch to drop to the left
47
- if (_root . x + _root .width > dropViewPort .x + dropViewPort .width ) {
47
+ if (xPos + _root .width > dropViewPort .x + dropViewPort .width ) {
48
48
_dropRight = false
49
- _root . x = clickRect .x - _root .width
49
+ xPos = clickRect .x - _root .width
50
50
}
51
51
52
52
// Default position of panel is vertically centered on click position
53
- _root . y = clickRect .y + (clickRect .height / 2 )
54
- _root . y -= _root .height / 2
53
+ let yPos = clickRect .y + (clickRect .height / 2 )
54
+ yPos -= _root .height / 2
55
55
56
56
// Make sure panel is within viewport
57
- let originRootY = _root .y
58
- _root .y = Math .max (_root .y , dropViewPort .y )
59
- _root .y = Math .min (_root .y , dropViewPort .y + dropViewPort .height - _root .height )
57
+ let originalYPos = yPos
58
+ yPos = Math .max (yPos, dropViewPort .y )
59
+ yPos = Math .min (yPos, dropViewPort .y + dropViewPort .height - _root .height )
60
+
61
+ _root .x = xPos
62
+ _root .y = yPos
60
63
61
64
// Adjust arrow position back to point at click position
62
- _arrowPointPositionY += originRootY - _root . y
65
+ _arrowPointPositionY += originalYPos - yPos
63
66
}
64
67
65
68
background: Item {
0 commit comments