Sainath Motlakunta
Sainath Motlakunta

Reputation: 945

How to Disable Dragging for Konva.Transformer in Konva.js?

I'm using Konva.Transformer in my Konva.js application and I'm encountering an issue. I've set up a functionality where clicking on a node adds it to the transformer, but I want to disable the ability to drag the transformer itself. However, setting transformer.draggable(false) doesn't seem to work as expected. Is there a way to achieve this and disable the dragging of the transformer component in Konva.js?

Here's the relevant code snippet:

// Setting up Konva.Transformer
var transformer = new Konva.Transformer();

// Adding a node to the transformer on click
node.on('click', function() {
    transformer.attachTo(node);
});

// Attempt to disable dragging of the transformer
transformer.draggable(false);

Despite setting draggable(false) on the transformer instance, I can still drag the transformer itself. How can I properly disable this dragging functionality?

Any help would be appreciated. Thank you!

Upvotes: 0

Views: 191

Answers (0)

Related Questions