api-issue-tracker icon indicating copy to clipboard operation
api-issue-tracker copied to clipboard

PDF cursors on Mac can fail to display

Open Fredosixx opened this issue 5 years ago • 6 comments
trafficstars

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?

Fredosixx avatar May 21 '20 19:05 Fredosixx

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:

SPL_cursor_creation.pdf

SPL_cursor_creation

Fredosixx avatar May 23 '20 12:05 Fredosixx

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.

DanRathbun avatar May 23 '20 18:05 DanRathbun

Definitely, a relative position of the hot spot would be welcome, especially when you use vector-based cursors (SVG or PDF).

Fredosixx avatar May 23 '20 19:05 Fredosixx

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.

thomthom avatar May 25 '20 15:05 thomthom

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

DanRathbun avatar May 27 '20 01:05 DanRathbun

SU-46196

sketchupbot avatar Jun 01 '20 06:06 sketchupbot