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/01 12:12:38 UTC

[royale-asjs] branch develop updated: Emulation - make sure no traces of 'mousedown' are left after selecting a color

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 49ff83b758 Emulation - make sure no traces of 'mousedown' are left after selecting a color
49ff83b758 is described below

commit 49ff83b7581f9ac438ddc8968cc59914700c5e26
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Thu Dec 1 14:12:30 2022 +0200

    Emulation - make sure no traces of 'mousedown' are left after selecting a color
---
 .../MXRoyale/src/main/resources/defaults.css       |  1 +
 .../src/main/resources/mx-royale-manifest.xml      |  1 +
 .../royale/mx/controls/beads/ColorPickerView.as    |  7 ++-
 .../src/main/royale/mx/controls/beads/ListView.as  | 68 ++++++++++++++++++++++
 4 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index a181ee9d2a..81b77bcfb6 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -217,6 +217,7 @@ Basic|ColorPalette
 {
 	IBeadModel: ClassReference("org.apache.royale.html.beads.models.ArrayListSelectionModel");
 	IDataProviderItemRendererMapper: ClassReference("org.apache.royale.html.beads.DataItemRendererFactoryForArrayList");
+	IBeadView: ClassReference("mx.controls.beads.ListView");
 }
 
 ComboBox
diff --git a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
index cbb4a8918a..b112c6afe3 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
+++ b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
@@ -244,6 +244,7 @@
 
     <!-- ColorPicker-->
 	<component id="ColorPickerPopUp" class="mx.controls.beads.ColorPickerPopUp" />
+	<component id="ListView" class="mx.controls.beads.ListView" />
     <!-- new/experimental -->
     <component id="SimpleTextHighlighter" class="mx.controls.SimpleTextHighlighter" />
 </componentPackage>
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 5f9c8808a0..488a620197 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
@@ -226,8 +226,11 @@ package mx.controls.beads
 		{
 			colorChangeAction();
 			//'change' events should only be from User-initiated changes
-			if (!programmaticChange) (_strand as IEventDispatcher).dispatchEvent(new ColorPickerEvent("change"));
-			popUpVisible = false;
+			if (!programmaticChange)
+			{
+				(_strand as IEventDispatcher).dispatchEvent(new ColorPickerEvent("change"));
+				popUpVisible = false;
+			}
 		}
 		
 		/**
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ListView.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ListView.as
new file mode 100644
index 0000000000..598f7bc348
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ListView.as
@@ -0,0 +1,68 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+	COMPILE::SWF
+	{
+	import org.apache.royale.core.IStrand;
+	}
+	import org.apache.royale.core.IItemRenderer;
+	import org.apache.royale.core.ISelectableItemRenderer;
+	import org.apache.royale.events.Event;
+	import org.apache.royale.utils.getSelectionRenderBead;
+	import org.apache.royale.html.beads.ListView;
+
+	/**
+	 *  The List class creates the visual elements of the org.apache.royale.html.List
+	 *  component. A List consists of the area to display the data (in the dataGroup), any
+	 *  scrollbars, and so forth.
+	 *
+	 *  @viewbead
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9.10
+	 */
+	COMPILE::JS
+	public class ListView extends org.apache.royale.html.beads.ListView
+	{
+		override protected function selectionChangeHandler(event:Event):void
+		{
+			var selectionBead:ISelectableItemRenderer;
+			var ir:IItemRenderer = dataGroup.getItemRendererForIndex(lastSelectedIndex) as IItemRenderer;
+			if (ir) 
+			{
+				selectionBead = getSelectionRenderBead(ir);
+				if (selectionBead)
+				{
+					selectionBead.selected = false;
+					selectionBead.down = false;
+				}
+			}
+			ir = dataGroup.getItemRendererForIndex(listModel.selectedIndex) as IItemRenderer;
+			if (ir) {
+				selectionBead = getSelectionRenderBead(ir);
+				if (selectionBead)
+					selectionBead.selected = true;
+			}
+			lastSelectedIndex = listModel.selectedIndex;
+		}
+
+	}
+}