javascript - panning position changes after modifying image fabricjs -


i have image placing on canvas @ (0,0) call function places image @ new point (0,100). 1 position of image shift y=100 position , strange behaviour there- bounding box (that controls panning/scaling of image) shifted pixel top of image , once click there bounding box returns actual image position.

my js code follows

var img = document.createelement("img"); img.src = "car.png"; var canvas; var imginstance;  var imagedetails; $(img).on('load', function () {    canvas = new fabric.canvas("imagecanvas");    imginstance = new fabric.image(img, {       top: 0,       left: 0    });    canvas.add(imginstance);    fullwidth(); });   function fullwidth() {    var scaleratio = canvas.width / imginstance.width;    imginstance.scale(scaleratio);    console.log(scaleratio);    if (imginstance.height < canvas.height) {       console.log('canvas bigger');       imginstance.set({top: 150});//((canvas.height- imginstance.height)/2);       //console.log(((canvas.height- imagedetails.height)/2));    }    ;    canvas.renderall();    //canvas.calcoffset(); }; 


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -