How to get from selection pixels value instead of point units

When I capture these values ​​they come in unit point - how can I get the value converted to pixels from that same result when making a selection? or can i get the selection value in pixels not in unit points

set
{_target: Array(1), to: {…}, _isCommand: true}
to:
bottom:
_unit: “distanceUnit”
_value: 1382.3999999999999
[[Prototype]]: Object
left:
_unit: “distanceUnit”
_value: 0
[[Prototype]]: Object
right:
_unit: “distanceUnit”
_value: 921.5999999999999
[[Prototype]]: Object
top:
_unit: “distanceUnit”
_value: 0
[[Prototype]]: Object
_obj: “rectangle”

I think the units are to be based on the user’s preference.
You could check your preference settings.

If I’m right you should be able to get the preference settings, change the units to pixel if necessary, get the data you need (in pixels) and change the preference back to the original settings.

Have you tried replacing:

_unit: “distanceUnit”   
Per:
_unit: "pixelsUnit"

Thanks but I change the rule to pixels and get unipixels value.

Jarda and I have been working on the Selection API in the past months, hopefully it’ll be released soon (ish).

2 Likes

ok. thanks for a better help