diff options
| author | jmoenig <jens@moenig.org> | 2014-12-03 12:48:31 +0100 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2014-12-03 12:48:31 +0100 |
| commit | 17b6ae839b5c15c942440f38fc07bfcc45bc0811 (patch) | |
| tree | fabea790fbe8978d1647c958a6e226b87f5feb72 /objects.js | |
| parent | d94d9ff4e85b50ce57e4c62d63250994c4b9b4c7 (diff) | |
| download | snap-yow-17b6ae839b5c15c942440f38fc07bfcc45bc0811.tar.gz snap-yow-17b6ae839b5c15c942440f38fc07bfcc45bc0811.zip | |
Improve edge-collision detection of default sprite “arrow” shape
Diffstat (limited to 'objects.js')
| -rw-r--r-- | objects.js | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -125,7 +125,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2014-December-01'; +modules.objects = '2014-December-03'; var SpriteMorph; var StageMorph; @@ -3238,8 +3238,11 @@ SpriteMorph.prototype.setCenter = function (aPoint, justMe) { SpriteMorph.prototype.nestingBounds = function () { // same as fullBounds(), except that it uses "parts" instead of children - var result; - result = this.bounds; + // and special cases the costume-less "arrow" shape's bounding box + var result = this.bounds; + if (!this.costume && this.penBounds) { + result = this.penBounds.translateBy(this.position()); + } this.parts.forEach(function (part) { if (part.isVisible) { result = result.merge(part.nestingBounds()); |
