2
* Copyright 2013 Canonical Ltd.
4
* This file is part of webbrowser-app.
6
* webbrowser-app is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 3.
10
* webbrowser-app is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
import Ubuntu.Components 0.1
25
property alias rect: __rect
27
property real __minimumWidth: units.gu(5)
28
property real __minimumHeight: units.gu(5)
34
// dismiss the selection when tapping anywhere except for the handles
35
onClicked: __container.visible = false
50
color: parent.border.color
64
if (__leftHandle.dragging) {
65
return __rect.x + __rect.width - (__leftHandle.x + __leftHandle.width / 2)
66
} else if (__rightHandle.dragging) {
67
return __rightHandle.x + __rightHandle.width / 2 - __rect.x
75
if (__topHandle.dragging) {
76
return __rect.y + __rect.height - (__topHandle.y + __topHandle.height / 2)
77
} else if (__bottomHandle.dragging) {
78
return __bottomHandle.y + __bottomHandle.height / 2 - __rect.y
85
left: __rightHandle.dragging ? __rect.left: undefined
86
right: __leftHandle.dragging ? __rect.right : undefined
87
top: __bottomHandle.dragging ? __rect.top : undefined
88
bottom: __topHandle.dragging ? __rect.bottom : undefined
95
x: __rect.x - width / 2
96
y: (__topHandle.y + __bottomHandle.y) / 2
98
maximum: __rightHandle.x - __container.__minimumWidth
101
__rect.width = __rightHandle.x - __leftHandle.x
102
__rect.x = __leftHandle.x + __leftHandle.width / 2
103
__container.resized()
111
x: (__leftHandle.x + __rightHandle.x) / 2
112
y: __rect.y - height / 2
114
maximum: __bottomHandle.y - __container.__minimumHeight
117
__rect.height = __bottomHandle.y - __topHandle.y
118
__rect.y = __topHandle.y + __topHandle.height / 2
119
__container.resized()
127
x: __rect.x + __rect.width - width / 2
128
y: (__topHandle.y + __bottomHandle.y) / 2
129
minimum: __leftHandle.x + __container.__minimumWidth
130
maximum: __container.width
133
__rect.width = __rightHandle.x - __leftHandle.x
134
__container.resized()
142
x: (__leftHandle.x + __rightHandle.x) / 2
143
y: __rect.y + __rect.height - height / 2
144
minimum: __topHandle.y + __container.__minimumHeight
145
maximum: __container.height
148
__rect.height = __bottomHandle.y - __topHandle.y
149
__container.resized()