Closed joncursi closed 3 years ago
@joncursi
Guides's new version is released.
digit prop is added (default: 0) set digit 1 ~ 2
And the behavior of snapThreshold has been changed. The snapThreshold moves in px units independent of zoom.
Awesome! Thank you @daybrush :)
@joncursi I am trying to make the ruler starting 0 at the point of white space. How did you achieve that. Could you please guide me ?
nvm i found it.. Thanks :)
I need to render my rulers using inches as the unit, rather than pixels. So I supply the following two props to the
Guides
component:where
zoomValue
is a decimal representing how far the user has zoomed in/out of the canvas.The base rendering and scrolling of the rulers is working great. Here is what my 8.5x11 document looks like on the canvas:
However, the guides cannot be placed in the correct position by the user for 2 reasons:
On initial placement, the guides will "snap" to the nearest integer unit, which in my case, is to the nearest inch. Here I have demonstrated this below:
You can eventually finagle the guide to a non-integer unit, however once the user zooms in/out (changes the
zoomValue
), the guides will snap again to the nearest integer (which again, in my case, is to the nearest inch). Demonstration below:I have tried using the
snapThreshold
prop to try to make the snap threshold more granular or to even turn the snapping off altogether, but it doesn't seem to respect values less than1
.Furthermore, when trying to display drag position via the
dragPosFormat
function, the value supplied into this function is a also a whole number, so if my guide is placed between 0-0.5 inches, it will tell me the drag position is0
, and if the guide is between 0.5-1.5 inches it will tell me the drag position is1
. We need more granularity in these values.Seems like in general, we just need to allow this library to support more granular values for all the props / functionality to enable usage with custom units.
This issue may be related to https://github.com/daybrush/guides/issues/26.