on xenial help sign in
more accurate left/top/right hit testing
commitbb2f7b5910b9bb48998a72aa7f7a24075dfcd151 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 30 Aug 2016, 13:05 (10 years ago) parent9eaba2a
2 files changed+9−6
qml/Stages/MoveHandler.qml+6−6 qml/Stages/WindowControlsOverlay.qml+3
qml/Stages/MoveHandler.qml+6−6
@@ -144,18 +144,18 @@ Item {
144144 priv.resetEdges();
145145 priv.nearBottomRightCorner = true;
146146 root.fakeMaximizeBottomRightAnimationRequested(priv.progress);
147− } else if (sensingPoints.topLeft.x < priv.triggerArea && target.canBeMaximizedLeftRight) { // left
148− priv.progress = MathUtils.clampAndProject(sensingPoints.topLeft.x, priv.triggerArea, 0, 0, 1);
147+ } else if (sensingPoints.left.x < priv.triggerArea && target.canBeMaximizedLeftRight) { // left
148+ priv.progress = MathUtils.clampAndProject(sensingPoints.left.x, priv.triggerArea, 0, 0, 1);
149149 priv.resetEdges();
150150 priv.nearLeftEdge = true;
151151 root.fakeMaximizeLeftAnimationRequested(priv.progress);
152− } else if (sensingPoints.topRight.x > stageWidth - priv.triggerArea && target.canBeMaximizedLeftRight) { // right
153− priv.progress = MathUtils.clampAndProject(sensingPoints.topRight.x, stageWidth - priv.triggerArea, stageWidth, 0, 1);
152+ } else if (sensingPoints.right.x > stageWidth - priv.triggerArea && target.canBeMaximizedLeftRight) { // right
153+ priv.progress = MathUtils.clampAndProject(sensingPoints.right.x, stageWidth - priv.triggerArea, stageWidth, 0, 1);
154154 priv.resetEdges();
155155 priv.nearRightEdge = true;
156156 root.fakeMaximizeRightAnimationRequested(priv.progress);
157− } else if (sensingPoints.topLeft.y < PanelState.panelHeight && target.canBeMaximized) { // top
158− priv.progress = MathUtils.clampAndProject(sensingPoints.topLeft.y, Math.max(PanelState.panelHeight, priv.triggerArea), 0, 0, 1);
157+ } else if (sensingPoints.top.y < PanelState.panelHeight && target.canBeMaximized) { // top
158+ priv.progress = MathUtils.clampAndProject(sensingPoints.top.y, Math.max(PanelState.panelHeight, priv.triggerArea), 0, 0, 1);
159159 priv.resetEdges();
160160 priv.nearTopEdge = true;
161161 root.fakeMaximizeAnimationRequested(priv.progress);
qml/Stages/WindowControlsOverlay.qml+3
@@ -107,6 +107,9 @@ Item {
107107 var bottommost = Math.max.apply(Math, yPoints);
108108
109109 return {
110+ left: mapToItem(target.parent, leftmost, (topmost+bottommost)/2),
111+ top: mapToItem(target.parent, (leftmost+rightmost)/2, topmost),
112+ right: mapToItem(target.parent, rightmost, (topmost+bottommost)/2),
110113 topLeft: mapToItem(target.parent, leftmost, topmost),
111114 topRight: mapToItem(target.parent, rightmost, topmost),
112115 bottomLeft: mapToItem(target.parent, leftmost, bottommost),