This is an automated email from the ASF dual-hosted git repository.
yishayw 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 c5cebfd069 Emulation - CP - sync text input with selected colors when
visible
c5cebfd069 is described below
commit c5cebfd069494b11be55714637a954a562ee1a77
Author: Yishay Weiss <[email protected]>
AuthorDate: Mon Dec 5 14:38:06 2022 +0200
Emulation - CP - sync text input with selected colors when visible
---
.../royale/mx/controls/beads/ColorPickerPopUp.as | 23 ++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git
a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ColorPickerPopUp.as
b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ColorPickerPopUp.as
index 21ec5305b4..d9be4938ee 100644
---
a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ColorPickerPopUp.as
+++
b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ColorPickerPopUp.as
@@ -19,7 +19,6 @@
package mx.controls.beads
{
import org.apache.royale.core.IColorModel;
- import org.apache.royale.core.IColorSpectrumModel;
import org.apache.royale.core.IStrand;
import org.apache.royale.core.UIBase;
import org.apache.royale.utils.loadBeadFromValuesManager;
@@ -35,6 +34,7 @@ package mx.controls.beads
import org.apache.royale.html.beads.DispatchInputFinishedBead;
import org.apache.royale.html.accessories.RestrictToColorTextInputBead;
import org.apache.royale.core.IStrandWithModel;
+ import org.apache.royale.html.ControlBar;
/**
* The ColorPickerPopUp class is used in ColorPicker. It contains a
set of controls for picking a color.
@@ -49,6 +49,7 @@ package mx.controls.beads
public class ColorPickerPopUp extends UIBase implements
IColorPickerPopUp, IBead
{
protected var colorPalette:ColorPalette;
+ protected var controlBar:Group;
protected var textInput:TextInput;
protected var selectedColorDisplay:Group;
protected var host:IStrand;
@@ -64,13 +65,14 @@ package mx.controls.beads
{
super();
colorPalette = new ColorPalette();
+ controlBar = new ControlBar();
var colorPaletteLayout:TileLayout =
loadBeadFromValuesManager(TileLayout, "iBeadLayout", colorPalette) as
TileLayout;
selectedColorDisplay = new Group();
(selectedColorDisplay as IStyleableObject).className =
"ColorPickerDisplayedColor";
var irDim:int = 11;
var margin:int = 2;
colorPaletteLayout.rowHeight =
colorPaletteLayout.columnWidth = irDim;
- colorPalette.width = irDim * 20;
+ colorPalette.width = controlBar.width = irDim * 20;
selectedColorDisplay.width = irDim * 4;
textInput = new TextInput();
textInput.width = 62;
@@ -78,11 +80,14 @@ package mx.controls.beads
selectedColorDisplay.y = textInput.y = margin;
selectedColorDisplay.height = textInput.height = 24;
colorPalette.y = selectedColorDisplay.height + margin *
2;
+ controlBar.addElement(selectedColorDisplay);
+ controlBar.addElement(textInput);
COMPILE::JS
{
selectedColorDisplay.element.style.position =
"absolute";
textInput.element.style.position = "absolute";
colorPalette.element.style.position =
"absolute";
+ controlBar.element.style.backgroundColor =
"#e6e6e6";
}
}
@@ -90,18 +95,20 @@ package mx.controls.beads
{
super.model = value;
colorPalette.model = value;
- if (getElementIndex(selectedColorDisplay) < 0)
+ if (getElementIndex(controlBar) < 0)
{
- addElement(selectedColorDisplay);
- }
- if (getElementIndex(textInput) < 0)
- {
- addElement(textInput);
+ addElement(controlBar);
}
if (getElementIndex(colorPalette) < 0)
{
addElement(colorPalette);
}
+ var colorAsAttr:String =
CSSUtils.attributeFromColor((value as IColorModel).color);
+ COMPILE::JS
+ {
+
selectedColorDisplay.element.style.backgroundColor = colorAsAttr;
+ }
+ textInput.text = colorAsAttr.slice(1);
}
public function set strand(value:IStrand):void