Converting to pixels


Author
Message
Kolfers
Kolfers
Distinguished Member (3.6K reputation)Distinguished Member (3.6K reputation)Distinguished Member (3.6K reputation)Distinguished Member (3.6K reputation)Distinguished Member (3.6K reputation)Distinguished Member (3.6K reputation)Distinguished Member (3.6K reputation)Distinguished Member (3.6K reputation)Distinguished Member (3.6K reputation)
Group: Forum Members
Posts: 24, Visits: 137
Hi, 

I spent some time figuring out why my dynamic positioning didn't work. In the end I realized this does not work: 
/ position = (900 * 1px, 900 * 1px)

however this does:
/ position = (1px * 900,1px * 900)


Is there a reason why the order of the components matters? 

Thank you!

Kerwin

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
Yes, order matters. The unit of the first term determines the unit of the result:

1px * 400 -> result will be interpreted as pixels
400 * 1px -> result will  be interpreted as pure integer (no unit)

The reason this matters is that there must be a way to deal with terms with different units. E.g, should 1px * 400pct return a result in pixels or percentages? The order of the terms allows you/ the program to decide that.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search