|
|
|
@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
import QtQuick 2.7
|
|
|
|
|
|
|
|
import FishUI 1.0 as FishUI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
color: "transparent"
|
|
|
|
|
|
|
|
border.width: 2
|
|
|
|
|
|
|
|
border.color: FishUI.Theme.highlightColor
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
property var control: parent
|
|
|
|
|
|
|
|
DragRect {
|
|
|
|
|
|
|
|
posType: posLeftTop
|
|
|
|
|
|
|
|
onPosChange: {
|
|
|
|
|
|
|
|
//不要简化这个判断条件,至少让以后维护的人能看懂。化简过后我自己都看不懂了。
|
|
|
|
|
|
|
|
if (control.x + xOffset < control.x + control.width)
|
|
|
|
|
|
|
|
control.x += xOffset;
|
|
|
|
|
|
|
|
if (control.y + yOffset < control.y + control.height)
|
|
|
|
|
|
|
|
control.y += yOffset;
|
|
|
|
|
|
|
|
if (control.width - xOffset > 0)
|
|
|
|
|
|
|
|
control.width-= xOffset;
|
|
|
|
|
|
|
|
if (control.height -yOffset > 0)
|
|
|
|
|
|
|
|
control.height -= yOffset;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DragRect {
|
|
|
|
|
|
|
|
posType: posRightTop
|
|
|
|
|
|
|
|
x: parent.width - width
|
|
|
|
|
|
|
|
onPosChange: {
|
|
|
|
|
|
|
|
//向左拖动时,xOffset为负数
|
|
|
|
|
|
|
|
if (control.width + xOffset > 0)
|
|
|
|
|
|
|
|
control.width += xOffset;
|
|
|
|
|
|
|
|
if (control.height - yOffset > 0)
|
|
|
|
|
|
|
|
control.height -= yOffset;
|
|
|
|
|
|
|
|
if (control.y + yOffset < control.y + control.height)
|
|
|
|
|
|
|
|
control.y += yOffset;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DragRect {
|
|
|
|
|
|
|
|
posType: posLeftBottom
|
|
|
|
|
|
|
|
y: parent.height - height
|
|
|
|
|
|
|
|
onPosChange: {
|
|
|
|
|
|
|
|
if (control.x + xOffset < control.x + control.width)
|
|
|
|
|
|
|
|
control.x += xOffset;
|
|
|
|
|
|
|
|
if (control.width - xOffset > 0)
|
|
|
|
|
|
|
|
control.width-= xOffset;
|
|
|
|
|
|
|
|
if (control.height + yOffset > 0)
|
|
|
|
|
|
|
|
control.height += yOffset;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DragRect {
|
|
|
|
|
|
|
|
posType: posRightBottom
|
|
|
|
|
|
|
|
x: parent.width - width
|
|
|
|
|
|
|
|
y: parent.height - height
|
|
|
|
|
|
|
|
onPosChange: {
|
|
|
|
|
|
|
|
if (control.width + xOffset > 0)
|
|
|
|
|
|
|
|
control.width += xOffset;
|
|
|
|
|
|
|
|
if (control.height + yOffset > 0)
|
|
|
|
|
|
|
|
control.height += yOffset;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|