Skip to content

Shared DND Cursors are no longer shown when read from ImageDescriptor #3047

Open
@ptziegler

Description

@ptziegler

Consider the following code snippet where sourceName is ISharedImages.IMG_OBJS_DND_LEFT_SOURCE and maskName is ISharedImages.IMG_OBJS_DND_LEFT_MASK:

private static Cursor createCursor(String sourceName, String maskName) {
	ImageDescriptor source = ISharedImages.get().getImageDescriptor(sourceName);
	ImageDescriptor mask = ISharedImages.get().getImageDescriptor(maskName);
	ImageData sourceData = source.getImageData(100);
	ImageData maskData = mask.getImageData(100);
	// Hotspot should be the center of the image. e.g. (16, 16) on 100% zoom
	int hotspotX = sourceData.width / 2;
	int hotspotY = sourceData.height / 2;
	return new Cursor(null, sourceData, maskData, hotspotX, hotspotY);
}

With 58e4313, these icons no longer show up, because the PNG icons have been swapped out with SVG icons.

Recording.webm

If I forcefully switch to the PNG icons, the cursor shows up again.

Recording2.webm

Notes

  • The issue is related to the mask. If the mask is a PNG, the cursor is shown, even if the source is an SVG. So the issue is not with the SVGs in general.
  • If I create the maskData via mask.createImage().getImageData(100); the cursor is shown, even when using an SVG image.
  • If I use ISharedImages.get().getImage(maskName), the cursor is also shown.

So the problem seems to be some weird interaction between SVGs and the ImageDescriptor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions