This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Marty Laurita
Posted Sep 15 - Read on Facebook

Hey Framers,

Having trouble with a new prototype. It's a pixel measuring tool and I can't get it to work quite right. Click the BG once to set the first point, twice to set the second point, and three times to reset.

1. It only works if you click from the top-left to the bottom-right.
2. If I want to drag the crosshairs around, the location doesn't update properly and the width/height of the box doesn't track properly.



Krijn Rijshouwer

Hey Marty!

This happens because you're using Math.abs on the xVal and yVal. When clicked left of the crosshair this means it's a negative xVal which in the current code is forced to be positive. You can fix this by only using Math abs for the width and also calculating the rectangle's x and y position. Here is a fixed version →

Read the entire post on Facebook