笙默考试管理系统-MyExamTest----codemirror(16)

笙默考试管理系统-MyExamTest----codemirror(16

目录

一、 笙默考试管理系统-MyExamTest----codemirror

二、 笙默考试管理系统-MyExamTest----codemirror

三、 笙默考试管理系统-MyExamTest----codemirror

四、 笙默考试管理系统-MyExamTest----codemirror

五、 笙默考试管理系统-MyExamTest----codemirror

  • 笙默考试管理系统-MyExamTest----codemirror

   // Uses a set of changes plus the current scroll position to

        // determine which DOM updates have to be made, and makes the

        // updates.

        function updateDisplay(changes, suppressCallback) {

            if (!scroller.clientWidth) {

                showingFrom = showingTo = displayOffset = 0;

                return;

            }

  • 笙默考试管理系统-MyExamTest----codemirror

            // Compute the new visible window

            var visible = visibleLines();

            // Bail out if the visible area is already rendered and nothing changed.

            if (changes !== true && changes.length == 0 && visible.from >= showingFrom && visible.to <= showingTo) return;

            var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);

            if (showingFrom < from && from - showingFrom < 20) from = showingFrom;

            if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);

  • 笙默考试管理系统-MyExamTest----codemirror

            // Create a range of theoretically intact lines, and punch holes

            // in that using the change info.

            var intact = changes === true ? [] :

                computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);

            // Clip off the parts that won't be visible

            var intactLines = 0;

            for (var i = 0; i < intact.length; ++i) {

                var range = intact[i];

                if (range.from < from) {range.domStart += (from - range.from); range.from = from;}

  • 笙默考试管理系统-MyExamTest----codemirror

                if (range.to > to) range.to = to;

                if (range.from >= range.to) intact.splice(i--, 1);

                else intactLines += range.to - range.from;

            }

            if (intactLines == to - from) return;

            intact.sort(function(a, b) {return a.domStart - b.domStart;});

  • 笙默考试管理系统-MyExamTest----codemirror

            var th = textHeight(), gutterDisplay = gutter.style.display;

            lineDiv.style.display = gutter.style.display = "none";

            patchDisplay(from, to, intact);

            lineDiv.style.display = "";

            // Position the mover div to align with the lines it's supposed

            // to be showing (which will cover the visible display)

            var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;

            // This is just a bogus formula that detects when the editor is

            // resized or the font size changes.

            if (different) lastSizeC = scroller.clientHeight + th;

            showingFrom = from; showingTo = to;

            displayOffset = heightAtLine(doc, from);

            mover.style.top = (displayOffset * th) + "px";

            code.style.height = (doc.height * th + 2 * paddingTop()) + "px";

你可能感兴趣的:(笙默考试管理系统,javascript,前端,开发语言)