1

以下异常的原因是什么?

DOMException: Failed to execute 'getStartPositionOfChar' on 'SVGTextContentElement': The charnum provided (0) is greater than or equal to the maximum bound (0).

实际上,我正在尝试将https://github.com/nlplab/brat与我自己创建的后端集成。它使用 svg 与 jquery.svg.min.js 和 jquery.svgdom.min.js。但我被这个例外困住了。在进行调用时,在 svg 的文本元素上引发了异常

text.getStartPositionOfChar(firstChar).x;

文本在哪里

<text x="0" y="0">Some Text</text>

firstChar=0

4

2 回答 2

0

我相信该错误已在 master 分支中修复,但未在打包版本 1.3 上修复。尝试用直接从 GitHub 克隆的 ( git clone https://github.com/nlplab/brat.git) 替换你的小子。

于 2017-06-14T04:30:04.213 回答
0

使用最新的 git 分支对我不起作用(尽管它可能会修复其他问题)!

我认为这是一个时间问题,因为有时重新渲染有效,有时因上述错误而失败。

我在函数中添加了一个小的超时值(在第 3141 行),它似乎已经修复了它,但代价是渲染延迟很小。

在此处输入图像描述

于 2021-09-25T11:06:24.427 回答