Skip to content

Commit

Permalink
Prevent error in border image renderer when side slices get calculate…
Browse files Browse the repository at this point in the history
…d to less than zero width or height
  • Loading branch information
Jason Johnston committed Mar 6, 2011
1 parent 58d2df7 commit 8aa3f1b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sources/BorderImageRenderer.js
Expand Up @@ -19,9 +19,10 @@ PIE.BorderImageRenderer = PIE.RendererBase.newRenderer( {
},

draw: function() {
this.getBox(); //make sure pieces are created

var props = this.styleInfos.borderImageInfo.getProps(),
bounds = this.boundsInfo.getBounds(),
box = this.getBox(), //make sure pieces are created
el = this.targetElement,
pieces = this.pieces;

Expand All @@ -42,9 +43,10 @@ PIE.BorderImageRenderer = PIE.RendererBase.newRenderer( {

// Piece positions and sizes
function setSizeAndPos( piece, w, h, x, y ) {
var s = pieces[piece].style;
s.width = w;
s.height = h;
var s = pieces[piece].style,
max = Math.max;
s.width = max(w, 0);
s.height = max(h, 0);
s.left = x;
s.top = y;
}
Expand Down

0 comments on commit 8aa3f1b

Please sign in to comment.