Interactive area is cut off when sprite is scaled down

This is a weird one.

So I have a box. Right now everything is stripped away so its just adding a sprite as a child, that draws the graphics, and has button mode ON. When the box is not scaled, everything works fine.

However, if my box IS scaled (by 0.7 specifically), everything does not work fine.

I have no idea why this is happening, several coworkers have tried to help me out to no avail.

Any ideas?

I would show code but it’s honestly very simple, however if you really need to see the code I can provide it.

I’m on the latest libs, and on the html5 target.

Thanks for your help!

The same thing happen when you use hittestobject or hittestpoint and scaleX,scaleY… is like the graphics are scaled but but the reference tothe object not

in this situation its actually the opposite–the graphics get scaled, but the hit area gets scaled down even more. @singmajesty might need your help on this one

Update on this: this issue only occurs in canvas mode. When switching to DOM, the issue becomes a bit more clear: its actually the graphics themselves not being scaled correctly. On DOM the box is smaller, and matches the hit area.

This sounds like a regression after adding graphics upscaling, perhaps you could see if adding -Dopenfl-disable-graphics-upscaling makes a difference. Could you also share your test code?

I added that flag, no difference :S. Code is:

class Item extends Sprite
{
	var equation:Equation;
	var firstLine:Line;
	public function new() 
	{
		super();
		var box:Sprite = new Sprite();
		box.x = 100;
		box.y = 100;
		
		box.graphics.beginFill(Colors.BLUE, 1);
		box.graphics.drawRect(0, 0, 300*scale, 300*scale);
		box.graphics.endFill();
		addChild(box);
		box.buttonMode = true;
		//box.scaleX = box.scaleY = 0.7;
	}

(there’s some stuff after that, but it’s all commented out)

Thanks, I just got this working in HTML5 :slight_smile:

1 Like

Hello again–did you ever get this fixed on HTML5? or should I be opening an issue on the github?

I believe this is fixed in the current releases

Up to OpenFL 4.5.2 it was still broken for me :confused:

This is working properly in my testing, but perhaps you might be able to help with code to reproduce the issue you’re seeing?

Hm…I was working on a project recently where the issue occurred, but now when I try to reproduce it everything works fine. If I come across it again I’ll be sure to send some sample code to reproduce it with.

Thank you for the help!

1 Like