mirror of
https://github.com/QuasarApp/ViewSolutions.git
synced 2025-05-01 04:04:43 +00:00
fix ImageView added ratation power property
This commit is contained in:
parent
c4595d05b8
commit
44918a4927
@ -10,6 +10,7 @@ Item {
|
||||
property string text: ""
|
||||
property bool hover: false
|
||||
property bool presed: false
|
||||
property real power: 1.0
|
||||
|
||||
property string toolTip: ""
|
||||
|
||||
@ -87,47 +88,6 @@ Item {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
|
||||
hoverEnabled: true;
|
||||
|
||||
onEntered: {
|
||||
hover = true
|
||||
}
|
||||
|
||||
onExited: {
|
||||
hover = false;
|
||||
privateData.ry = 0
|
||||
privateData.rx = 0
|
||||
|
||||
}
|
||||
|
||||
onMouseXChanged: {
|
||||
const fromCenter = root.width / 2
|
||||
privateData.ry = -((mouse.x - fromCenter) / (fromCenter * 0.05))
|
||||
|
||||
}
|
||||
onMouseYChanged: {
|
||||
const fromCenter = root.height / 2
|
||||
|
||||
privateData.rx = ((mouse.y - fromCenter) / (fromCenter * 0.05))
|
||||
}
|
||||
|
||||
onPressed: {
|
||||
presed = true;
|
||||
}
|
||||
|
||||
onReleased: {
|
||||
presed = false;
|
||||
|
||||
root.clicked(mouse)
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
}
|
||||
|
||||
|
||||
transform: [
|
||||
Rotation {
|
||||
axis { x: 0; y: 0; z: 1 }
|
||||
@ -155,4 +115,46 @@ Item {
|
||||
|
||||
}
|
||||
|
||||
|
||||
MouseArea {
|
||||
|
||||
hoverEnabled: true;
|
||||
|
||||
onEntered: {
|
||||
hover = true
|
||||
}
|
||||
|
||||
onExited: {
|
||||
hover = false;
|
||||
privateData.ry = 0
|
||||
privateData.rx = 0
|
||||
|
||||
}
|
||||
|
||||
onMouseXChanged: {
|
||||
const fromCenter = root.width / 2
|
||||
privateData.ry = -((mouse.x - fromCenter) / (fromCenter * 0.05)) * power
|
||||
|
||||
}
|
||||
onMouseYChanged: {
|
||||
const fromCenter = root.height / 2
|
||||
|
||||
privateData.rx = ((mouse.y - fromCenter) / (fromCenter * 0.05)) * power
|
||||
}
|
||||
|
||||
onPressed: {
|
||||
presed = true;
|
||||
}
|
||||
|
||||
onReleased: {
|
||||
presed = false;
|
||||
|
||||
root.clicked(mouse)
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,10 @@ ViewPortDelegatBase {
|
||||
property string title: ""
|
||||
property string text: ""
|
||||
property int textMargins: 10
|
||||
property int additionalHeight: getBrCount(text) * sourceText.fontInfo.pixelSize
|
||||
property int sourceTextPointSize: 20
|
||||
property int headerTextPointSize: 32
|
||||
|
||||
property int additionalHeight: getBrCount(text) * sourceText.fontInfo.pixelSize + textMargins
|
||||
|
||||
function getBrCount(text) {
|
||||
return (text.match(/<br>/g) || []).length;
|
||||
@ -40,7 +43,7 @@ ViewPortDelegatBase {
|
||||
Label {
|
||||
id: header
|
||||
font.bold: true
|
||||
font.pointSize: 32
|
||||
font.pointSize: headerTextPointSize
|
||||
text: title;
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
@ -63,7 +66,7 @@ ViewPortDelegatBase {
|
||||
Label {
|
||||
id: sourceText
|
||||
font.bold: false
|
||||
font.pointSize: 20
|
||||
font.pointSize: sourceTextPointSize
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: root.text
|
||||
|
Loading…
x
Reference in New Issue
Block a user