2

I am trying to make a dynamic text editor in SVG using two.js, I have a custom blinking cursor (cursor functionality, it is same as input field in HTML like I can move around the cursor in sentence edit, add, delete characters). I want to place the cursor exactly after a specific character.

I am picking up the DOM width using .getBBox() and .getBoundingClientRect and maintaining the cursor position but I am facing a problem when I am trying to edit in the middle of the sentence.

TAB
  • 1,944
  • 8
  • 28
  • 45
  • Please add your code. – Jack Bashford Mar 29 '19 at 09:32
  • 2
    In order to find the width of a char in SVG you may use the `getExtentOfChar` method. There is also a `getSubStringLength` method you may use. If this doesn't help please add your code. – enxaneta Mar 29 '19 at 09:41
  • 1
    There is a whole range of methods bundled with the [SVGTextContentElement interface](https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement). – ccprog Mar 29 '19 at 12:54

0 Answers0