Skip to content
Browse files

Fix for issue #239: fix indexes for border shapes so they get cleaned…

… up correctly
  • Loading branch information...
1 parent 6855c66 commit e50a437c6d481cee599e990f7e7979fecb165733 @lojjic committed Aug 19, 2012
Showing with 50 additions and 4 deletions.
  1. +4 −4 sources/BorderRenderer.js
  2. +46 −0 tests/submitted/issue239.html
View
8 sources/BorderRenderer.js
@@ -57,14 +57,14 @@ PIE.BorderRenderer = PIE.RendererBase.newRenderer( {
var me = this,
props = me.styleInfos.borderInfo.getProps(),
bounds = me.boundsInfo.getBounds(),
- shape, segmentsInfo, i, len;
+ shape, segmentsInfo, i, j, len;
if( props ) {
me.hideBorder();
segmentsInfo = me.getBorderSegmentsInfo();
- for( i = 0, len = segmentsInfo.length; i < len; i += 2) {
- shape = me.getShape( 'border' + i, me.shapeZIndex );
+ for( i = j = 0, len = segmentsInfo.length; i < len; i += 2) {
+ shape = me.getShape( 'border' + j++, me.shapeZIndex );
shape.setSize( bounds.w, bounds.h );
shape.setAttrs(
'path', segmentsInfo[ i ]
@@ -75,7 +75,7 @@ PIE.BorderRenderer = PIE.RendererBase.newRenderer( {
}
// remove any previously-created border shapes which didn't get used above
- while( me.deleteShape( 'border' + i++ ) ) {}
+ while( me.deleteShape( 'border' + j++ ) ) {}
}
},
View
46 tests/submitted/issue239.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <style>
+ html {
+ -pie-load-path: "../../build" ;
+ }
+ div {
+ color:#FFF ;
+ padding-left:10px ;
+ font-size:24px ;
+ behavior: url(../../build/PIE.htc);
+ }
+ #test {
+ border:10px solid #000 ;
+ border-radius:100px 100px 100px 100px ;
+ -pie-background: linear-gradient(left, rgba(0, 0, 255, 0.2), rgba(0, 0, 255, 1));
+ position:absolute ;
+ width:350px ;
+ height:350px ;
+ cursor:move ;
+ }
+ </style>
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
+</head>
+<body>
+<div id="test">
+ <input type="button" onclick="change_border() ;" value="Step 1: Change Border First" /><br />
+ <input type="button" onclick="change_size() ;" value="Step 2: Now Change Size (Randomized)" /><br /><br />
+ Drag me!
+</div>
+<script>
+ $("#test").draggable() ;
+
+ function change_border() {
+ $("#test").css("border","dashed 10px #000") ;
+ }
+
+ function change_size() {
+ $("#test").css("width",Math.random()*300+100) ;
+ $("#test").css("height",Math.random()*300+100) ;
+ }
+</script>
+</body>
+</html>

0 comments on commit e50a437

Please sign in to comment.
Something went wrong with that request. Please try again.