You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2013/06/19 22:17:09 UTC

git commit: [flex-asjs] [refs/heads/develop] - Added metrics for assisting with sizing components.

Updated Branches:
  refs/heads/develop 53b1bfcd0 -> 10e22bde6


Added metrics for assisting with sizing components.


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

Branch: refs/heads/develop
Commit: 10e22bde6da40a60049fbda0e41418bc267fbb52
Parents: 53b1bfc
Author: Peter Ent <pe...@apache.org>
Authored: Wed Jun 19 16:16:58 2013 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Wed Jun 19 16:16:58 2013 -0400

----------------------------------------------------------------------
 .../as/src/org/apache/flex/core/UIMetrics.as    | 35 ++++++++++++++
 .../as/src/org/apache/flex/utils/BeadMetrics.as | 50 ++++++++++++++++++++
 2 files changed, 85 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/10e22bde/frameworks/as/src/org/apache/flex/core/UIMetrics.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/core/UIMetrics.as b/frameworks/as/src/org/apache/flex/core/UIMetrics.as
new file mode 100644
index 0000000..345c75c
--- /dev/null
+++ b/frameworks/as/src/org/apache/flex/core/UIMetrics.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.flex.core
+{
+	public class UIMetrics
+	{
+		public function UIMetrics()
+		{
+		}
+		
+		public var x:Number;
+		
+		public var y:Number;
+		
+		public var width:Number;
+		
+		public var height:Number;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/10e22bde/frameworks/as/src/org/apache/flex/utils/BeadMetrics.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/utils/BeadMetrics.as b/frameworks/as/src/org/apache/flex/utils/BeadMetrics.as
new file mode 100644
index 0000000..be4c405
--- /dev/null
+++ b/frameworks/as/src/org/apache/flex/utils/BeadMetrics.as
@@ -0,0 +1,50 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.flex.utils
+{
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.UIBase;
+	import org.apache.flex.core.UIMetrics;
+	import org.apache.flex.core.ValuesManager;
+
+public class BeadMetrics
+{
+	
+	public static function getMetrics(strand:IStrand) : UIMetrics
+	{
+		var borderThickness:Object = ValuesManager.valuesImpl.getValue(strand,"border-thickness");
+		var borderOffset:Number;
+		if( borderThickness == null ) {
+			borderOffset = 0;
+		}
+		else {
+			borderOffset = Number(borderThickness);
+			if( isNaN(borderOffset) ) borderOffset = 0;
+		}
+		
+		var result:UIMetrics = new UIMetrics();
+		result.x = borderOffset;
+		result.y = borderOffset;
+		result.width = UIBase(strand).width - 2*borderOffset;
+		result.height = UIBase(strand).height - 2*borderOffset;
+		
+		return result;
+	}
+}
+}
\ No newline at end of file