Hi all,
I am facing a problem regarding the values returned by charCoords().
I am using the result of charCoords() to draw a rectangle over some characters. And I have identified 3 cases (two of them shown in the following image):
-
Case 1 is where everything works, as for the green, brown & gray marks, where my green rectange exactly matches the mark in codemirror.
-
Case 2, when there are differences in detecting the mark end. In this case, I have noticed that always capital letters are involved in the underlying codemirror mark I want to reproduce.
-
Case 3 (not shown in the image), is when a long line is involved. In this case I get return values that can be moved horizontally almost half a window, like in the following image:
The code that draws all rectangles is the same. In the case of the long line, the return value from charCoords({line:1, ch:0}, “page”) can have a left property in the range of 400-500 pixels.
Am I doing anything wrong?
(The function that draws the green boxes is here: clarin-el-annotation-tool/text-widget.js at 01e41c5f2f2d02715d61d43444225e68e47c6d91 · iit-Demokritos/clarin-el-annotation-tool · GitHub)