(widget)
| 2 | import { e_target } from "../util/event.js" |
| 3 | |
| 4 | export function widgetHeight(widget) { |
| 5 | if (widget.height != null) return widget.height |
| 6 | let cm = widget.doc.cm |
| 7 | if (!cm) return 0 |
| 8 | if (!contains(document.body, widget.node)) { |
| 9 | let parentStyle = "position: relative;" |
| 10 | if (widget.coverGutter) |
| 11 | parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;" |
| 12 | if (widget.noHScroll) |
| 13 | parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;" |
| 14 | removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle)) |
| 15 | } |
| 16 | return widget.height = widget.node.parentNode.offsetHeight |
| 17 | } |
| 18 | |
| 19 | // Return true when the given mouse event happened in a widget |
| 20 | export function eventInWidget(display, e) { |
no test coverage detected