javascript - kinetic-v3.8.2.js breaks kinetic-v3.6.0.js and kinetic-image-plugin-v1.0.1.js, how to fix? -
i'm trying make kinetic canvas can add pictures source dynamically , wanted grid in background used kinetic.rect kinetic v3.8.2. images needs draggable, kinetic v.3.6.0, if set draggable when having v3.8.2 active breaks. "config undefined" according firebug. "img.kinetic.draggable not method" says firebug.
is there fix this?
can post small example? there have been changes kinetic api. here draggable image 3.8.2:
<!doctype html> <html> <head> <script type='text/javascript' src='js/kinetic/kinetic-v3.8.2.js'></script> <script type='text/javascript'> window.onload = function () { var stage = new kinetic.stage('container', 400, 300); var layer = new kinetic.layer({ name: 'somelayer' }); var logo = new image(); logo.onload = function() { var myimage = new kinetic.image({ x: stage.width / 2 - (logo.width / 2) , y: stage.height - logo.height - 5 , image: logo , width: logo.width , height: logo.height }); myimage.draggable(true) layer.add(myimage); layer.draw(); } logo.src = "\./resources/images/ccs_logo.png"; stage.add(layer) } </script> </head> <body onmousedown="return false;" bgcolor=#000000> <div id="container"> </div> </body> </html>
most notably, configs introduced class instantiation. kinetic rectangle used defined so:
var rect = new kinetic.rectangle(function () { //do drawing stuff here });
but defined config (an object literal):
var rect = new kinetic.rectangle({ x: 0, y: 0, height: 20, width: 20 });
you can see examples in docs; check out updated kineticjs tutorials.
Comments
Post a Comment