diff options
Diffstat (limited to 'morphic.js')
| -rw-r--r-- | morphic.js | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -1041,7 +1041,7 @@ /*global window, HTMLCanvasElement, getMinimumFontHeight, FileReader, Audio, FileList, getBlurredShadowSupport*/ -var morphicVersion = '2014-November-20'; +var morphicVersion = '2014-December-03'; var modules = {}; // keep track of additional loaded modules var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug @@ -3978,6 +3978,7 @@ PenMorph.prototype.init = function () { this.size = 1; this.wantsRedraw = false; this.penPoint = 'tip'; // or 'center" + this.penBounds = null; // rect around the visible arrow shape HandleMorph.uber.init.call(this); this.setExtent(new Point(size, size)); @@ -4000,11 +4001,9 @@ PenMorph.prototype.changed = function () { // PenMorph display: PenMorph.prototype.drawNew = function (facing) { -/* - my orientation can be overridden with the "facing" parameter to - implement Scratch-style rotation styles + // my orientation can be overridden with the "facing" parameter to + // implement Scratch-style rotation styles -*/ var context, start, dest, left, right, len, direction = facing || this.heading; @@ -4027,6 +4026,15 @@ PenMorph.prototype.drawNew = function (facing) { right = start.distanceAngle(len * 0.33, direction - 230); } + // cache penBounds + this.penBounds = new Rectangle( + Math.min(start.x, dest.x, left.x, right.x), + Math.min(start.y, dest.y, left.y, right.y), + Math.max(start.x, dest.x, left.x, right.x), + Math.max(start.y, dest.y, left.y, right.y) + ); + + // draw arrow shape context.fillStyle = this.color.toString(); context.beginPath(); @@ -4043,7 +4051,6 @@ PenMorph.prototype.drawNew = function (facing) { context.lineWidth = 1; context.stroke(); context.fill(); - }; // PenMorph access: |
