|
1 | | -import chroma, common, dom2 as dom, html5_canvas, input, internal, math, os, |
| 1 | +import chroma, common, dom2 as dom, jsutils/canvas, input, internal, math, os, |
2 | 2 | strformat, strutils, tables, vmath, html/ajax, json |
3 | 3 |
|
4 | 4 | const defaultStyle = """ |
|
28 | 28 | var |
29 | 29 | rootDomNode*: Element |
30 | 30 | canvasNode*: Element |
31 | | - ctx*: CanvasRenderingContext2D |
| 31 | + ctx*: Context2d |
32 | 32 |
|
33 | 33 | forceTextReLayout*: bool |
34 | 34 |
|
|
119 | 119 | ideographicBaseline*: float |
120 | 120 |
|
121 | 121 | proc measureText( |
122 | | - ctx: CanvasRenderingContext2D, |
| 122 | + ctx: Context2d, |
123 | 123 | text: cstring |
124 | 124 | ): TextMetrics {.importcpp.} |
125 | 125 |
|
@@ -247,6 +247,9 @@ proc draw*(index: int, node: Node, parent: Node) = |
247 | 247 | if node.hasDifferent(uid): |
248 | 248 | node.element.setAttribute("id", node.uid) |
249 | 249 |
|
| 250 | + if node.hasDifferent(tooltip): |
| 251 | + node.element.setAttribute("title", node.tooltip) |
| 252 | + |
250 | 253 | node.zIndex = |
251 | 254 | if parent != nil: |
252 | 255 | parent.nodes.len - index |
@@ -291,7 +294,10 @@ proc draw*(index: int, node: Node, parent: Node) = |
291 | 294 |
|
292 | 295 | if node.hasDifferent(text): |
293 | 296 | if keyboard.focusNode != node: |
294 | | - node.textElement.innerText = node.text |
| 297 | + if node.asHTML: |
| 298 | + node.textElement.innerHtml = node.text |
| 299 | + else: |
| 300 | + node.textElement.innerText = node.text |
295 | 301 | else: |
296 | 302 | # Don't mess with inner text when user is typing! |
297 | 303 | discard |
|
0 commit comments