Ckeck if a property is one, two or three dimensions

Find out why the . goes before the /

Moderator: Paul Tuersley

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

November 15th, 2014, 7:02 am

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

November 24th, 2014, 1:26 pm

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

November 25th, 2014, 2:22 am

Ok thanks!
Post Reply