flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject [39/50] git commit: [flex-asjs] [refs/heads/feature/mdl] - - Fix issue with double click event propagation. Problem was caused by "label" which contains "input" - Once label was clicked event was dispatched double. In order to fix that "preventDefault" w
Date Fri, 27 Jan 2017 22:14:20 GMT
- Fix issue with double click event propagation. Problem was caused by "label" which contains
"input" - Once label was clicked event was dispatched double.
In order to fix that "preventDefault" was called and manually checked input
- Once "preventDefault" was called event "change" stopped working - Need to manually raise
it in "selected"


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/0ea37155
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/0ea37155
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/0ea37155

Branch: refs/heads/feature/mdl
Commit: 0ea371554bf795446d5ae2c3e029288b0b5ff6f3
Parents: 5d87a38
Author: piotrz <piotrz@apache.org>
Authored: Thu Jan 26 00:53:10 2017 +0100
Committer: piotrz <piotrz@apache.org>
Committed: Thu Jan 26 00:53:10 2017 +0100

----------------------------------------------------------------------
 .../src/main/flex/org/apache/flex/mdl/IconToggle.as            | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0ea37155/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/IconToggle.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/IconToggle.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/IconToggle.as
index 6bab489..601ca1f 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/IconToggle.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/IconToggle.as
@@ -119,6 +119,7 @@ package org.apache.flex.mdl
         public function set selected(value:Boolean):void
         {
             IToggleButtonModel(model).selected = value;
+            dispatchEvent(new Event(Event.CHANGE))
         }
 
         private var _dataMdlFor:String = "icon-toggle-1";
@@ -227,7 +228,7 @@ package org.apache.flex.mdl
                 input.type = "checkbox";
                 input.checked = false;
                 input.classList.add("mdl-icon-toggle__input");
-
+                
                 label.appendChild(input);
             }
             else 
@@ -248,7 +249,10 @@ package org.apache.flex.mdl
         COMPILE::JS
         public function clickHandler(event:Event):void
         {
+            event.preventDefault();
             selected = !selected;
+            input.checked = selected;
+            label.classList.toggle("is-checked", selected);
         }
 
         COMPILE::SWF


Mime
View raw message