Ckeck if a property is one, two or three dimensions

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
bkan
Posts: 51
Joined: November 6th, 2013, 8:33 am

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!
User avatar
axymark
Posts: 23
Joined: November 29th, 2013, 7:04 am

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.
bkan
Posts: 51
Joined: November 6th, 2013, 8:33 am

Ok thanks!
Post Reply