3

I am using Konva.js in my project and I have a specific need to define text inside a draggable rectangle that was defined using Konva.Rect() class.Is there a way to achieve this without using a separate Konva.Text() or Konva.Label() class object since that would become way too complicated.

Open to suggestions.Thanks!

Gajanan Kulkarni
  • 697
  • 6
  • 22
Haris
  • 45
  • 5

1 Answers1

4

Your options are:

  1. Use Konva.Label
  2. Create a draggable group with rectangle and text inside
  3. Create one custom shape. Draw rectangle and text inside sceneFunc
lavrton
  • 18,973
  • 4
  • 30
  • 63
  • I see.Thanks for the elaboration.However, this would still involve using more than one Konva controls I guess. – Haris Apr 10 '18 at 06:11
  • Hi, Do you by chance have an example code for the same? I new to Konva and struggling to achieve this in my `Vuejs/Nuxtjs` application. Any help would be really appreciated. Thanks in advance. https://stackoverflow.com/q/69842757/7584240 – BATMAN_2008 Nov 05 '21 at 10:09