Konvajs how to dragging a Transformer programatically

41 Views Asked by At

I want my transformer dragging the bottom-right down and up automatically to a certain point when the page is loaded without user interaction. But I can't find a way to do that.

Here my transformer

  const tr = new Konva.Transformer({
    keepRatio: true,
    borderStrokeWidth: 3,
    borderStroke: "blue",
    enabledAnchors: ['top-left', 'top-right', 'bottom-left', 'bottom-right']
  });
1

There are 1 best solutions below

0
Vanquished Wombat On

Transformer size matches the size of the shapes within it. In your use case of showing that the height of an image can be changed, set the height of the image and call transformer.forceUpdate() to ensure the transformer sees the change.

See https://konvajs.org/docs/select_and_transform/Force_Update.html