MCPcopy
hub / github.com/DHTMLX/gantt / initScrollbars

Function initScrollbars

samples/common/codehighlight/codemirror.js:3740–3760  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

3738 var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
3739
3740 function initScrollbars(cm) {
3741 if (cm.display.scrollbars) {
3742 cm.display.scrollbars.clear();
3743 if (cm.display.scrollbars.addClass)
3744 { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
3745 }
3746
3747 cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
3748 cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
3749 // Prevent clicks in the scrollbars from killing focus
3750 on(node, "mousedown", function () {
3751 if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
3752 });
3753 node.setAttribute("cm-not-content", "true");
3754 }, function (pos, axis) {
3755 if (axis == "horizontal") { setScrollLeft(cm, pos); }
3756 else { updateScrollTop(cm, pos); }
3757 }, cm);
3758 if (cm.display.scrollbars.addClass)
3759 { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
3760 }
3761
3762 // Operations are used to wrap a series of changes to the editor
3763 // state in such a way that each change won't have to update the

Callers 2

defineOptionsFunction · 0.85
CodeMirrorFunction · 0.85

Calls 7

rmClassFunction · 0.85
setScrollLeftFunction · 0.85
updateScrollTopFunction · 0.85
addClassFunction · 0.85
onFunction · 0.70
clearMethod · 0.65
focusMethod · 0.65

Tested by

no test coverage detected