MonashAlexandria / snapapps

a visual programming language inspired by Scratch
http://snap.berkeley.edu
2 stars 5 forks source link

Automatic sprite center detection #86

Open Craxic opened 8 years ago

Craxic commented 8 years ago

A user attempted to flip a sprite using the horizontal and vertical flip buttons in the paint editor.

Because the sprite center was not set, it caused the sprite to flip outside the bounds of the editor and disappear. Once the sprite center was chosen, the sprite could be flipped without issue.

The sprite center should be chosen automatically. Investigate if this is still an issue in the newest version of BYOB.

aidanlane commented 8 years ago

Great :) Was it a bug in Snap?

Craxic commented 8 years ago

Haha, well, not really. It just assumes that the centre of the sprite is the centre of the canvas you can draw on, which is wrong when you draw a sprite in the top left corner of the canvas, for example. So I just make it base the centre on the middle of all the non-transparent pixels.

aidanlane commented 8 years ago

Could it be a suggested improvement to Snap, as it seems quite generic?

Craxic commented 8 years ago

@aidanlane Done :) https://github.com/jmoenig/Snap--Build-Your-Own-Blocks/pull/1056.

aidanlane commented 8 years ago

Fantastic work @Craxic, Jens seemed to really like the patch! (just need to use existing bounding box function?)