-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IllegalArgumentException: Argument cannot be null when creating SharedCursor #464
Comments
Or another possibility is to get the private static Cursor createCursor(String sourceName) {
// ImageDescriptor will load @2x image
ImageDescriptor src = ImageDescriptor.createFromFile(Internal.class, sourceName);
Image img = src.createImage();
ImageData id = img.getImageData(getDeviceZoom());
img.dispose();
return new Cursor(null, id, 0, 0);
} |
There are other cursors created in gef-classic/org.eclipse.gef/src/org/eclipse/gef/ui/palette/FlyoutPaletteComposite.java Line 1540 in e1d163b
Because these are created with |
I agree that throwing an exception is definitely not the way to go. My initial approach would've been to fall back to the 100% zoom level, as you suggested. Alternatively, one could also make it so that it goes to the "closest" zoom level instead. e.g. from 125% to 100% and from 175% to 200%.
Wouldn't that cause the cursor to be scaled to the current zoom level? That might also work, though I'm a little concerned how good those scaled cursors will look...
Apparently, those icons come from here and haven't been updated in... 21 years. Yikes. There are no |
Yep, and they look a bit scrunched. But then so do the icons in the palette at that setting so they complement each other ;-). I experimented with things like "if displayZoom <= 150 then use 100" and "if displayZoom > 150 then use 200" but if the setting is |
Cursors for the Palette are created in the SharedCursors class. The
ImageData
is returned from theImageDescriptor
at the current device zoom level. But if the zoom level is not 100% or 200% thenImageData
will be null and an exception is thrown.-Dswt.autoScale=150
This is caused by the
ImageDescriptor
not finding an image with a@1.5x
suffix.Perhaps a fallback is required so that if ImageData is null 100% zoom is used instead?
The text was updated successfully, but these errors were encountered: