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

发布时间:2023年12月26日

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

目录

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

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

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

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

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

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

???},

????????insertHeight: function(at, lines, height) {

????????????this.size += lines.length;

????????????this.height += height;

????????????for (var i = 0, e = this.children.length; i < e; ++i) {

????????????????var child = this.children[i], sz = child.chunkSize();

????????????????if (at <= sz) {

????????????????????child.insertHeight(at, lines, height);

????????????????????if (child.lines && child.lines.length > 50) {

????????????????????????while (child.lines.length > 50) {

????????????????????????????var spilled = child.lines.splice(child.lines.length - 25, 25);

????????????????????????????var newleaf = new LeafChunk(spilled);

????????????????????????????child.height -= newleaf.height;

????????????????????????????this.children.splice(i + 1, 0, newleaf);

????????????????????????????newleaf.parent = this;

????????????????????????}

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

????????????????????????this.maybeSpill();

????????????????????}

????????????????????break;

????????????????}

????????????????at -= sz;

????????????}

????????},

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

????????maybeSpill: function() {

????????????if (this.children.length <= 10) return;

????????????var me = this;

????????????do {

????????????????var spilled = me.children.splice(me.children.length - 5, 5);

????????????????var sibling = new BranchChunk(spilled);

????????????????if (!me.parent) { // Become the parent node

????????????????????var copy = new BranchChunk(me.children);

????????????????????copy.parent = me;

????????????????????me.children = [copy, sibling];

????????????????????me = copy;

????????????????} else {

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

????????????????????me.size -= sibling.size;

????????????????????me.height -= sibling.height;

????????????????????var myIndex = indexOf(me.parent.children, me);

????????????????????me.parent.children.splice(myIndex + 1, 0, sibling);

????????????????}

????????????????sibling.parent = me.parent;

????????????} while (me.children.length > 10);

????????????me.parent.maybeSpill();

????????},

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

????????iter: function(from, to, op) { this.iterN(from, to - from, op); },

????????iterN: function(at, n, op) {

????????????for (var i = 0, e = this.children.length; i < e; ++i) {

????????????????var child = this.children[i], sz = child.chunkSize();

????????????????if (at < sz) {

????????????????????var used = Math.min(n, sz - at);

????????????????????if (child.iterN(at, used, op)) return true;

????????????????????if ((n -= used) == 0) break;

????????????????????at = 0;

????????????????} else at -= sz;

????????????}

????????}

????};

????function getLineAt(chunk, n) {

????????while (!chunk.lines) {

????????????for (var i = 0;; ++i) {

????????????????var child = chunk.children[i], sz = child.chunkSize();

????????????????if (n < sz) { chunk = child; break; }

????????????????n -= sz;

????????????}

????????}

文章来源:https://blog.csdn.net/N201871643/article/details/135230644
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。