MCPcopy Index your code
hub / github.com/DHTMLX/gantt / adjustView

Function adjustView

samples/common/codehighlight/codemirror.js:3104–3121  ·  view source on GitHub ↗
(cm, from, to)

Source from the content-addressed store, hash-verified

3102 // Force the view to cover a given range, adding empty view element
3103 // or clipping off existing ones as needed.
3104 function adjustView(cm, from, to) {
3105 var display = cm.display, view = display.view;
3106 if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
3107 display.view = buildViewArray(cm, from, to);
3108 display.viewFrom = from;
3109 } else {
3110 if (display.viewFrom > from)
3111 { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
3112 else if (display.viewFrom < from)
3113 { display.view = display.view.slice(findViewIndex(cm, from)); }
3114 display.viewFrom = from;
3115 if (display.viewTo < to)
3116 { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
3117 else if (display.viewTo > to)
3118 { display.view = display.view.slice(0, findViewIndex(cm, to)); }
3119 }
3120 display.viewTo = to;
3121 }
3122
3123 // Count the number of lines in the view whose DOM representation is
3124 // out of date (or nonexistent).

Callers 1

updateDisplayIfNeededFunction · 0.85

Calls 2

buildViewArrayFunction · 0.85
findViewIndexFunction · 0.85

Tested by

no test coverage detected