Skip to content
Snippets Groups Projects
Select Git revision
  • fb77fd1726f6d13a14a1e2f342b00d5d59b9597f
  • test default protected
  • master protected
  • original
  • pirati-backup protected
  • beta-2
  • beta-1
  • v3.1.4
  • v3.1.3
  • v3.1.2
  • v3.1.1
  • v3.1.0
  • v3.0.16
  • v3.0.15
  • v3.0.14
  • v3.0.13
  • v3.0.12
  • v3.0.11
  • v3.0.10
  • v3.0.9
  • v3.0.8
  • v3.0.7
  • v3.0.6
  • v3.0.5
  • v3.0.4
25 results

glue.py

Blame
  • redrawer.js 1.37 KiB
    (function () {
      /**
       * Asynchronic redrawer
       * @param {MindMup} ysy
       * @constructor
       */
      function Repainter(ysy) {
        this.ysy = ysy;
        this.onRepaint = [];
        var self = this;
        var animationLoop = function () {
          var queue = self.onRepaint;
          if (queue.length > 0) {
            self.onRepaint = [];
            for (var i = 0; i < queue.length; i++) {
              var widget = queue[i];
              widget._redrawRequested = false;
              widget._render();
            }
          }
          requestAnimationFrame(animationLoop);
        };
        this.animationLoop = animationLoop;
      }
    
      Repainter.prototype.start = function () {
        this.animationLoop();
      };
      /**
       * Main function - insert widget into repaint queue (if not present there)
       * @param {Object} widget
       */
      Repainter.prototype.redrawMe = function (widget) {
        if (widget._redrawRequested) return;
        widget._redrawRequested = true;
        this.onRepaint.push(widget);
      };
      /**
       * Whole node tree will be repainted. Repaint can be delayed to next change by [noRender] parameter
       * @param {boolean} [noRender]
       */
      Repainter.prototype.forceRedraw = function (noRender) {
        var idea = this.ysy.idea;
        this.ysy.util.traverse(idea, function (node) {
          node.attr.force = true;
        });
        if (!noRender) {
          idea.dispatchEvent('changed');
        }
      };
      window.easyMindMupClasses.Repainter = Repainter;
    })();