You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/03/22 10:14:26 UTC
[royale-asjs] branch develop updated: BE0014: add rule to show
constraint
This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new c2ebd1a BE0014: add rule to show constraint
c2ebd1a is described below
commit c2ebd1a03ab347abe7986f73a0845272d75fd803
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sun Mar 22 11:14:22 2020 +0100
BE0014: add rule to show constraint
---
.../src/main/royale/BE0014_Working_with_Graphics.mxml | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/examples/blog/BE0014_Working_with_Graphics/src/main/royale/BE0014_Working_with_Graphics.mxml b/examples/blog/BE0014_Working_with_Graphics/src/main/royale/BE0014_Working_with_Graphics.mxml
index e398068..8f80b4e 100644
--- a/examples/blog/BE0014_Working_with_Graphics/src/main/royale/BE0014_Working_with_Graphics.mxml
+++ b/examples/blog/BE0014_Working_with_Graphics/src/main/royale/BE0014_Working_with_Graphics.mxml
@@ -23,6 +23,7 @@
xmlns:html="library://ns.apache.org/royale/html"
xmlns:svg="library://ns.apache.org/royale/svg"
xmlns:graphics="org.apache.royale.graphics.*">
+
<fx:Script>
<![CDATA[
import org.apache.royale.display.Graphics;
@@ -32,13 +33,14 @@
* The color of the liquid
*/
private var liquidColor:Number = 0x15CF12;
+
/**
* Fill the bottle
*/
private function changeFill(event:ValueChangeEvent):void {
var g:Graphics = Graphics.getInstanceFor(bgShape);
- var newHeight:Number = transformValueFromRange(slider.value, slider.minimum, slider.maximum, 0, 350);
+ var newHeight:Number = transformValueFromRange(slider.value, slider.minimum, slider.maximum, 0, rule.height);
var newY:Number = fgShape.height - newHeight;
g.clear();
@@ -86,6 +88,14 @@
<!-- liquid -->
<js:UIGraphicsBase localId="bgShape" width="400" height="500"/>
+ <!-- rule -->
+ <j:Group visible="{ruleVisibility.selected}">
+ <svg:Rect localId="rule" x="180" y="{bgShape.height - rule.height}" width="6" height="350">
+ <svg:fill>
+ <js:SolidColor color="#ff0000" alpha=".5"/>
+ </svg:fill>
+ </svg:Rect>
+ </j:Group>
<!-- fill mask -->
<svg:Image src="assets/bottle-mask.svg" width="400" height="500"/>
<!-- inner shade -->
@@ -93,11 +103,13 @@
<!-- main shape -->
<svg:Image src="assets/bottle-main.svg" width="400" height="500"/>
+
</j:Container>
</j:CardPrimaryContent>
<j:CardActions itemsHorizontalAlign="itemsRight" itemsVerticalAlign="itemsCentered">
+ <j:CheckBox localId="ruleVisibility" text="Show Rule" selected="true"/>
<j:Label text="Slide to fill"/>
- <j:HSlider localId="slider" width="250" value="0" minimum="0" maximum="500" valueChange="changeFill(event)"/>
+ <j:HSlider localId="slider" width="200" value="0" minimum="0" maximum="500" valueChange="changeFill(event)"/>
</j:CardActions>
</j:Card>
</j:View>