Shapes get repeated in kineticjs stage.draw()? -


when ever draw shape, call stage.draw() method, shapes repeated once again. question how add shapes without more occurrence of drawn shapes.
here sample code

//creating group adding text      var textgroup = new kinetic.group({                     x: e.pagex,                     y: e.pagey - posy,                     draggable: true,                     id: 'textgroup'                 });                 layer.add(textgroup);                 stage.add(layer);                 textname = 'text' + shapecount; //creating text                  var text = new kinetic.text({                     x: 0,                     y: 0,                     text: comment,                     fill: "#" + fillcolor,                     fontsize: 24,                     opacity: 0.5,                     name: textname                 }); //adding text group                 textgroup.add(text); //finally drawing stage                   stage.draw();    can me out?      in advance,  

you call draw() method on group added shape. redraw shapes in specific group. i.e. textgroup.draw()

in fact can call draw() method node (including, shapes, layers, stages, groups etc).

update

i made fiddle http://jsfiddle.net/u9xhe/1/. adding text shape, calling draw, adding text shape , calling draw again. nothing seems out of place in case.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -