javascript - many very confusing problems with kinetic.js -
i got problems understanding kinetic.js (the documentation horrible newbies...) hope can explain bad english.
problem 1: everytime when #reset canvas not resetting it. more pushing background image on actual canvas , when click on it jumps original...
function clearcanvas() { context.clearrect(0, 0, 1000, 1000); //whole canvas context.drawimage(buehneobj,0,0); //redraw main background image }
and call with:
reset = document.getelementbyid('reset'); document.getelementbyid('reset').onclick =function(){clearcanvas(); }
problem 2: slider build scaling image not working @ dont see problem... ...the variables global , if test alert see values existing...
standard jquery slider:
$('#scaleslider').slider({ animate: "fast", step: 0.1, value: 1, min: 0.1, max: 1, slide: function(event,ui){groesse = ui.value} //global variable });
i made hidden(display:none) , on click "block"
var scaleslider = document.getelementbyid('scaleslider').style; document.getelementbyid('resize').onclick =function(){ scaleslider.display ="block";}
and here's how kinetic parts (dragmotiv first start image) "groesse" variable x , y slider value(they can same scales correct):
var dragmotiv = new kinetic.image({ image: imageobj, x: 250, y: 300, width: 330, height: 263, rotationdeg: 0, scale: { x:groesse, y:groesse }, draggable: true, dragboundfunc: function(pos) { var newy = pos.y < 290 ? 290 : pos.y > 305 ? 305 : pos.y; var newx = pos.x < 250 ? 250 : pos.x > 390 ? 390 : pos.x; return { x: newx, y: newy }; } });
problem 3: saving not possible @ all.
i uploaded server let guys take @ it. know there 1 little thingy dont see(i hope so).
i think should not clear canvas, instead should keep record have drown , remove items, , redraw layer.
Comments
Post a Comment