MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / widgetHeight

Function widgetHeight

lib/web/CodeMirror/src/measurement/widgets.js:4–17  ·  view source on GitHub ↗
(widget)

Source from the content-addressed store, hash-verified

2import { e_target } from "../util/event.js"
3
4export 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
20export function eventInWidget(display, e) {

Callers 5

widgetTopHeightFunction · 0.90
changedMethod · 0.90
clearMethod · 0.90
changedMethod · 0.90
addLineWidgetFunction · 0.90

Calls 3

containsFunction · 0.90
removeChildrenAndAddFunction · 0.90
eltFunction · 0.90

Tested by

no test coverage detected