You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by pi...@apache.org on 2018/01/28 21:39:11 UTC

[royale-asjs] branch develop updated: Add imageWidth and imageHeight to ContactImageChip to have more control on the image part of MDL Chip

This is an automated email from the ASF dual-hosted git repository.

piotrz 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 085a2d5  Add imageWidth and imageHeight to ContactImageChip to have more control on the image part of MDL Chip
085a2d5 is described below

commit 085a2d5163625dc67745111249c4f4893b81f5e9
Author: Piotr Zarzycki <pi...@gmail.com>
AuthorDate: Sun Jan 28 22:39:03 2018 +0100

    Add imageWidth and imageHeight to ContactImageChip to have more control on the image part of MDL Chip
---
 .../apache/royale/mdl/beads/ContactImageChip.as    | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/beads/ContactImageChip.as b/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/beads/ContactImageChip.as
index 32ad512..013f9f6 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/beads/ContactImageChip.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/beads/ContactImageChip.as
@@ -53,6 +53,38 @@ package org.apache.royale.mdl.beads
         protected var contact:HTMLImageElement;
 
         private var _strand:IStrand;
+
+        private var _imageWidth:Number = 32;
+        private var _imageHeight:Number = 32;
+
+        /**
+         * Specifies the width of the image Chip, in pixels.
+         *
+         * @default 32px
+         * @langversion 3.0
+         * @playerversion Flash 10.2
+         * @playerversion AIR 2.6
+         * @productversion Royale 0.9.1
+         */
+        public function set imageWidth(value:Number):void
+        {
+            _imageWidth = value;
+        }
+
+        /**
+         * Specifies the height of the image Chip, in pixels.
+         *
+         * @default 32px
+         * @langversion 3.0
+         * @playerversion Flash 10.2
+         * @playerversion AIR 2.6
+         * @productversion Royale 0.9.1
+         */
+        public function set imageHeight(value:Number):void
+        {
+            _imageHeight = value;
+        }
+
         /**
 		 *  @copy org.apache.royale.core.IBead#strand
 		 *  
@@ -84,6 +116,8 @@ package org.apache.royale.mdl.beads
                     contact = document.createElement("img") as HTMLImageElement;
                     contact.classList.add("mdl-chip__contact");
                     contact.src = _source;
+                    contact.style["width"] = isNaN(_imageWidth) ? "32px" : String(_imageWidth) + "px";
+                    contact.style["height"] = isNaN(_imageHeight) ? "32px" : String(_imageHeight) + "px";
 
                     element.insertBefore(contact, host["chipTextSpan"]);
                 }

-- 
To stop receiving notification emails like this one, please contact
piotrz@apache.org.