TheMightyFingers / mightyeditor

http://mightyeditor.mightyfingers.com
Other
279 stars 61 forks source link

Issue when changing an object's frame #54

Open Merlinovitsch opened 9 years ago

Merlinovitsch commented 9 years ago

When selecting a different frame from an atlas (in the assetPreview panel), the frame gets updated, but it's other properties (width / height, scaleX / scaleY) do not.

A side-effect of this is that in the mapeditor, from the moment I change a frame of an object, I can't select that object by clicking (drag selection does work) and I can't move it by dragging either.

stauzs commented 9 years ago

Hi,

I have failed to reproduce your issue. Here is what I did:

1) uploaded atlas image 2) attached json data to the atlas image 3) placed GameObject on the map (by dragging uploaded image from assets panel). 4) selected created game object 5) picked different frame from assetPreview panel

Objects should maintain scale ratio, but width and height will change to frameWidth * scaleX and frameHeight * scaleY.

If you are doing something different - can you provide step by step instructions?

Might it be special case?Does it works after refresh?

stauzs commented 9 years ago

this is my test project: http://mightyeditor.mightyfingers.com/#p2clg/0

Merlinovitsch commented 9 years ago

I used the stamp tool to place the object with a small frame (something like 40x40) and then changing to a larger frame (160x320), not sure if that matters.

I don't seem to have any problems in your project, I have a test project in which it does. It made me think and I found that it does occur when changing to the large texture, but not to the smaller ones.

Is there a way to send you the project link by PM?

Merlinovitsch commented 9 years ago

Oh, it seems changing the frame is not the problem, oops :) I placed an object with the large frame and I couldn't select it. So it seems the size is the problem.

stauzs commented 9 years ago

Can you try to disable pixelPerfectPicking? click on the free spot on the map to bring up map settings - last option is pixelPerfectPicking - set it to 0 and try to select object again image

BTW - how big is large? larger that 1000 - 2000 or more? you can send me private email to: stauzs@gmail.com

Merlinovitsch commented 9 years ago

Disabling pixelPerfectPicking does make it go away, large is in this case 160x320 (relative to 40x40).

stauzs commented 9 years ago

So - by increasing pixel perfect picking alpha threshold should fix this issue?

basically we need to expose gameObject.input.pixelPerfectAlpha - to allow semi transparent selection. e.g. in this case when pixels gets blended due to large scale

Merlinovitsch commented 9 years ago

I think, in my case, it might be just alpha in itself. The large frame contains one color which is partially transparent. The small frames have an opaque part, a small edge which is partially transparent, and a fully transparent part. With pixel perfect picking I can only select the small frame when clicking the opaque part, not the edge or the transparent part, and I cannot select the large frame at all.

stauzs commented 9 years ago

You can check out if threshold will work for you - if you are in the hacking mood :) select object (e.g. from object list) hit F12 to bring up dev tools enter in the console: map.activeObject.object.input.pixelPerfectAlpha = 64 unselect object and try to select again also try to change 64 to something larger or smaller

Merlinovitsch commented 9 years ago

Yes, for the large frame a value of 217 works, and for the edge of the smaller frame 179.