You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2022/12/07 08:27:29 UTC
[royale-asjs] branch develop updated: Emulation CP - infra for changing skin according to mouse state
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 89cc3fd6ae Emulation CP - infra for changing skin according to mouse state
89cc3fd6ae is described below
commit 89cc3fd6aefd856737f350ee84e6d13df2ed1198
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Wed Dec 7 10:22:56 2022 +0200
Emulation CP - infra for changing skin according to mouse state
---
.../MXRoyale/src/main/resources/defaults.css | 7 +-
.../MXRoyale/src/main/royale/MXRoyaleClasses.as | 1 +
.../mx/controls/beads/ColorPickerController.as | 78 ++++++++++++++++++++++
.../royale/mx/controls/beads/ColorPickerView.as | 13 +++-
.../src/main/royale/mx/skins/ColorPickerSkin.as | 7 +-
5 files changed, 97 insertions(+), 9 deletions(-)
diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index 3d6d427552..071dec46f3 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -209,7 +209,7 @@ ColorPicker
{
IBeadModel: ClassReference("org.apache.royale.html.beads.models.ArrayListColorSelectionModel");
IBeadView: ClassReference("mx.controls.beads.ColorPickerView");
- IBeadController: ClassReference("org.apache.royale.html.beads.controllers.ComboBoxController");
+ IBeadController: ClassReference("mx.controls.beads.ColorPickerController");
IPopUp: ClassReference("mx.controls.beads.ColorPickerPopUp");
}
@@ -1149,10 +1149,5 @@ charts|DataTip
iMeasurementBead: ClassReference("org.apache.royale.html.beads.TextFieldLabelMeasurementBead");
}
- ColorPickerSkin
- {
- iconColor: #111111;
- disabledIconColor: #999999;
- }
}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index b64f43d1da..1b7bdf05b2 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -437,6 +437,7 @@ internal class MXRoyaleClasses
import mx.controls.SimpleTextHighlighter;SimpleTextHighlighter;
import mx.controls.beads.ColorPickerView; ColorPickerView;
+ import mx.controls.beads.ColorPickerController; ColorPickerController;
}
}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ColorPickerController.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ColorPickerController.as
new file mode 100644
index 0000000000..ffe5e08e58
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ColorPickerController.as
@@ -0,0 +1,78 @@
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package mx.controls.beads
+{
+ import org.apache.royale.events.Event;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.html.beads.IComboBoxView;
+ import org.apache.royale.html.beads.controllers.ComboBoxController;
+ import org.apache.royale.events.MouseEvent;
+ import mx.core.IUIComponent;
+
+ /**
+ * The ColorPickerView class creates the visual elements of the org.apache.royale.html.ColorPicker
+ * component. The job of the view bead is to put together the parts of the ComboBox such as the color container
+ * and org.apache.royale.html.Button to trigger the pop-up.
+ *
+ * @viewbead
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.10
+ */
+ public class ColorPickerController extends ComboBoxController
+ {
+
+ override protected function finishSetup(event:Event):void
+ {
+ super.finishSetup(event);
+ if (viewBead == null) {
+ viewBead = _strand.getBeadByType(IComboBoxView) as IComboBoxView;
+ }
+ (viewBead.popupButton as IEventDispatcher).addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
+ (viewBead.popupButton as IEventDispatcher).addEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
+ (viewBead.popupButton as IEventDispatcher).addEventListener(MouseEvent.MOUSE_OVER, handleMouseOver);
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
+ */
+ protected function handleMouseUp(event:MouseEvent):void
+ {
+ (event.target as IUIComponent).name = "upSkin";
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
+ */
+ protected function handleMouseDown(event:MouseEvent):void
+ {
+ (event.target as IUIComponent).name = "downSkin";
+ }
+
+ /**
+ * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
+ */
+ protected function handleMouseOver(event:MouseEvent):void
+ {
+ (event.target as IUIComponent).name = "overSkin";
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ColorPickerView.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ColorPickerView.as
index 2b5564c5e4..9cbe3894c3 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ColorPickerView.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ColorPickerView.as
@@ -116,6 +116,16 @@ package mx.controls.beads
return list;
}
+ /**
+ * @private
+ * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
+ * @royaleignorecoercion org.apache.royale.core.UIBase
+ */
+ private function handleDisableChange(event:Event=null):void
+ {
+ button.name = (_strand as UIComponent).enabled ? "upSkin" : "disabledSkin";
+ }
+
/**
* @private
* @royaleignorecoercion org.apache.royale.events.IEventDispatcher
@@ -128,7 +138,8 @@ package mx.controls.beads
var host:UIBase = value as UIBase;
selectedColorDisplay = button = new ColorPickerSkin();
- button.name = (_strand as UIComponent).enabled ? "upSkin" : "disabledSkin";
+ button.addEventListener("disabledChange", handleDisableChange)
+ handleDisableChange();
if (isNaN(host.width)) selectedColorDisplay.width = 25;
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/skins/ColorPickerSkin.as b/frameworks/projects/MXRoyale/src/main/royale/mx/skins/ColorPickerSkin.as
index e2dff8fbbf..89f853d3d5 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/skins/ColorPickerSkin.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/skins/ColorPickerSkin.as
@@ -114,7 +114,6 @@ public class ColorPickerSkin extends UIComponent
var arrowY:Number = (h - arrowHeight - bevelSize);
graphics.clear();
- graphics.lineStyle(1);
if (name == "upSkin" || name == "overSkin")
{
@@ -222,8 +221,12 @@ public class ColorPickerSkin extends UIComponent
override public function set name(value:String):void
{
+ var change:Boolean = value != name;
super.name = value;
- updateDisplayList(getExplicitOrMeasuredWidth(), getExplicitOrMeasuredHeight());
+ if (change)
+ {
+ // updateDisplayList(width, height); // uncomment when we figure out why this messes with mouse event handlers
+ }
}
//--------------------------------------------------------------------------