Page 1 of 1

Ckeck if a property is one, two or three dimensions

Posted: November 15th, 2014, 7:02 am
by bkan
Hello,
I want to know how many dimensions the selected property have. I don't find anything on this subject, please help me!
For example, if the selected property is "rotation", I want to know that there is only one dimension, but for the position, i need to know there is 2.
I know you know for the 2D or 3D but how can I know for oneD?

Thank you!

Re: Ckeck if a property is one, two or three dimensions

Posted: November 24th, 2014, 1:26 pm
by axymark
The weird thing is even if the layer is 2D, its transform values are still 3 dimensional. So property.value.length will return 3 for scale, position, anchor point, etc. even if your layer is 2D. But, it will return undefined for one dimensional values like rotation.

So, you might need a combination of threeDLayer attribute and property.value.length.

Or, a bit simpler, check if property.value[1] returns null or not. This way you will find out if property is one dimensional or multidimensional.

Re: Ckeck if a property is one, two or three dimensions

Posted: November 25th, 2014, 2:22 am
by bkan
Ok thanks!