mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 03:58:07 +02:00
Merge pull request #12790 from WolfGangS/bugfix/12759-editoverlay-subimage
Bugfix for #12759 Overlays.editOverlay not applying subImage property
This commit is contained in:
commit
213c35dab4
1 changed files with 16 additions and 11 deletions
|
@ -20,17 +20,7 @@ Overlay {
|
||||||
repeat: false
|
repeat: false
|
||||||
running: false
|
running: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (image.xSize === 0) {
|
recalculateMargins();
|
||||||
image.xSize = image.sourceSize.width - image.xStart;
|
|
||||||
}
|
|
||||||
if (image.ySize === 0) {
|
|
||||||
image.ySize = image.sourceSize.height - image.yStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
image.anchors.leftMargin = -image.xStart * root.width / image.xSize;
|
|
||||||
image.anchors.topMargin = -image.yStart * root.height / image.ySize;
|
|
||||||
image.anchors.rightMargin = (image.xStart + image.xSize - image.sourceSize.width) * root.width / image.xSize;
|
|
||||||
image.anchors.bottomMargin = (image.yStart + image.ySize - image.sourceSize.height) * root.height / image.ySize;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +34,20 @@ Overlay {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function recalculateMargins() {
|
||||||
|
if (image.xSize === 0) {
|
||||||
|
image.xSize = image.sourceSize.width - image.xStart;
|
||||||
|
}
|
||||||
|
if (image.ySize === 0) {
|
||||||
|
image.ySize = image.sourceSize.height - image.yStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
image.anchors.leftMargin = -image.xStart * root.width / image.xSize;
|
||||||
|
image.anchors.topMargin = -image.yStart * root.height / image.ySize;
|
||||||
|
image.anchors.rightMargin = (image.xStart + image.xSize - image.sourceSize.width) * root.width / image.xSize;
|
||||||
|
image.anchors.bottomMargin = (image.yStart + image.ySize - image.sourceSize.height) * root.height / image.ySize;
|
||||||
|
}
|
||||||
|
|
||||||
ColorOverlay {
|
ColorOverlay {
|
||||||
id: color
|
id: color
|
||||||
anchors.fill: image
|
anchors.fill: image
|
||||||
|
@ -62,6 +66,7 @@ Overlay {
|
||||||
case "height": image.ySize = value; break;
|
case "height": image.ySize = value; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
recalculateMargins();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePropertiesFromScript(properties) {
|
function updatePropertiesFromScript(properties) {
|
||||||
|
|
Loading…
Reference in a new issue