Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/AppletHandle.qml
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Line(s) | 91 | ColumnLayout { | |||
---|---|---|---|---|---|
100 | spacing: buttonMargin*2 | 100 | spacing: buttonMargin*2 | ||
101 | ActionButton { | 101 | ActionButton { | ||
102 | svg: configIconsSvg | 102 | svg: configIconsSvg | ||
103 | elementId: "size-diagonal-tr2bl" | 103 | elementId: "size-diagonal-tr2bl" | ||
104 | iconSize: root.iconSize | 104 | iconSize: root.iconSize | ||
105 | mainText: i18n("Resize") | 105 | mainText: i18n("Resize") | ||
106 | active: !resizeHandle.pressed | 106 | active: !resizeHandle.pressed | ||
107 | 107 | | |||
108 | MouseArea { | 108 | ResizeHandle { | ||
109 | id: resizeHandle | 109 | id: resizeHandle | ||
110 | anchors { | 110 | anchors { | ||
111 | fill: parent | 111 | fill: parent | ||
112 | margins: -buttonMargin | 112 | margins: -buttonMargin | ||
113 | } | 113 | } | ||
114 | 114 | onPressed: parent.hideToolTip(); | |||
115 | property int startX | 115 | cursorShape: parent.LayoutMirroring.enabled ? Qt.SizeFDiagCursor : Qt.SizeBDiagCursor | ||
116 | property int startY | 116 | moveX: parent.LayoutMirroring.enabled | ||
117 | 117 | moveY: true | |||
118 | onPressed: { | 118 | resizeWidth: true | ||
119 | parent.hideToolTip(); | 119 | resizeHeight: true | ||
120 | mouse.accepted = true | | |||
121 | animationsEnabled = false; | | |||
122 | startX = mouse.x; | | |||
123 | startY = mouse.y; | | |||
124 | appletItem.releasePosition(); | | |||
125 | appletItem.floating = true; | | |||
126 | appletContainer.clip = true | | |||
127 | } | | |||
128 | onPositionChanged: { | | |||
129 | var xDelta = startX - mouse.x; | | |||
130 | var yDelta = startY - mouse.y; | | |||
131 | | ||||
132 | if (LayoutMirroring.enabled) { | | |||
133 | var oldRight = appletItem.x + appletItem.width; | | |||
134 | appletItem.width = Math.min(Math.max(appletItem.minimumWidth, appletItem.width + xDelta), appletItem.maximumWidth); | | |||
135 | appletItem.x = oldRight - appletItem.width; | | |||
136 | } else { | | |||
137 | appletItem.width = Math.min(Math.max(appletItem.minimumWidth, appletItem.width - xDelta), appletItem.maximumWidth); | | |||
138 | } | | |||
139 | | ||||
140 | var oldBottom = appletItem.y + appletItem.height; | | |||
141 | appletItem.height = Math.min(Math.max(appletItem.minimumHeight, appletItem.height + yDelta), appletItem.maximumHeight); | | |||
142 | appletItem.y = oldBottom - appletItem.height; | | |||
143 | } | | |||
144 | onReleased: { | | |||
145 | animationsEnabled = true | | |||
146 | appletItem.floating = false; | | |||
147 | appletItem.positionItem(); | | |||
148 | root.layoutManager.save() | | |||
149 | appletContainer.clip = false | | |||
150 | } | | |||
151 | } | 120 | } | ||
152 | } | 121 | } | ||
153 | ActionButton { | 122 | ActionButton { | ||
154 | id: rotateButton | 123 | id: rotateButton | ||
155 | svg: configIconsSvg | 124 | svg: configIconsSvg | ||
156 | elementId: "rotate" | 125 | elementId: "rotate" | ||
157 | mainText: i18n("Rotate") | 126 | mainText: i18n("Rotate") | ||
158 | iconSize: root.iconSize | 127 | iconSize: root.iconSize | ||
▲ Show 20 Lines • Show All 182 Lines • Show Last 20 Lines |