Open Fredosixx opened 4 years ago
I made some additional tests and the problem is related to the HotSpot arguments and very specific to Mac OSX.
in UI.create_cursor(img_path, hx, hy)
, there is a limit to the value hx
and hy
, whether PDF or PNG format.
For FredoSpline, I need a hot spot in the bottom-left corner. So, with cursors of size 32x32, I would use hx=0
and hy= 32
. The cursor seems to be created and I get back a cursor id. HOWEVER, it does not display.
From my tests, it seems that the maximum value of hy
is 23
. Above, the cursor does not display.
On Windows, everything works correct, so this is definitely an issue for Mac OSX (I am on Catalina)
I attach one cursor used by FredoSpline, in PDF and in PNG so that you can try to reproduce the issue:
With the addition of support for display scaling, it might be beneficial for coders if the x and y values could accept a Float value as a percentage of the scaled size from the top left corner of the cursor's "field".
So, using Fredo's above example, it would be nice if he could pass 0.0
, 1.0
for x and y.
Definitely, a relative position of the hot spot would be welcome, especially when you use vector-based cursors (SVG or PDF).
From my tests, it seems that the maximum value of hy is 23. Above, the cursor does not display.
Oh, that's interesting. A good clue.
I'm using PDFs for vector cursors in my extensions and I had not observed this. But a quick scan of my cursors indicate my max y value has been 19.
The UI::create_cursor
documentation is not at all clear what that the nominal cursor size is.
... and what happens with respect to display scaling. (Is it automatic, or is UI::scale_factor
required to be used?)
@thomthom I've opened a documentation specific issue for this method. See #918
SU-46196
Since SU2016, the Tool class seems to support SVG cursors on Windows and this works fine.
However, I just realized that on Mac, PDF cursors are not supported. I use PDF cursors in FredoSpline.
In the API documentation, it is written:
Since SketchUp 2016 it is possible to provide vector images for the cursors. SVG format for Windows and PDF format for OS X.
Am I correct?
Or is there a particular way to encode the PDF?