Search code examples
javascripthtmlimagekineticjs

KineticJS 5.0 - image drag and resize


I'm trying to resize images using KineticJS library with drag and drop technique. The code works perfect with v4.5.3 of the library - when I drag an anchor, the image is resizing. But after I updated KineticJS to 5.0, anchors are moving correctly, but the image isn't - nothing happens.

Here are fiddles with both versions (only diff is KineticJS version):
- kineticJS 4.5.3: http://jsfiddle.net/uAK9k/1/
- kineticJS 5.0: http://jsfiddle.net/uAK9k/

I think the problem is in update(activeAnchor) function, but I can't resolve this...
Thank you very much in advance!


Solution

  • Some api changes:

    1. setPosition(x,y) -> setPosition({x:x, y: y})
    2. setSize(width, height) -> setWidth(width);setHeight(height)

    http://jsfiddle.net/lavrton/hseUk/