Sha256: 9e419d68936e8f4061aa5725008a32ac000be32e285e0bb6691fa85f72bb442b
Contents?: true
Size: 1.87 KB
Versions: 3
Compression:
Stored size: 1.87 KB
Contents
/* --- script: Render.js description: A module that provides rendering workflow license: Public domain (http://unlicense.org). authors: Yaroslaff Fedin requires: - LSD.Module.DOM - LSD.Module.Events provides: - LSD.Module.Render ... */ LSD.Module.Render = new Class({ options: { render: null }, constructors: { render: function() { this.redraws = 0; this.dirty = true; } }, render: function() { if (!this.built) this.build(); delete this.halted; this.redraws++; this.fireEvent('render', arguments) this.childNodes.each(function(child){ if (child.render) child.render(); }); }, /* Update marks widget as willing to render. That can be followed by a call to *render* to trigger redrawing mechanism. Otherwise, the widget stay marked and can be rendered together with ascendant widget. */ update: function(recursive) { if (recursive) LSD.Module.DOM.walk(this, function(widget) { widget.update(); }); }, /* Refresh updates and renders widget (or a widget tree if optional argument is true). It is a reliable way to have all elements redrawn, but a costly too. Should be avoided when possible to let internals handle the rendering and avoid some unnecessary calculations. */ refresh: function(recursive) { this.update(recursive); return this.render(); }, /* Halt marks widget as failed to render. Possible use cases: - Dimensions depend on child widgets that are not rendered yet - Dont let the widget render when it is not in DOM */ halt: function() { if (this.halted) return false; this.halted = true; return true; } }); LSD.Module.Events.addEvents.call(LSD.Module.Render.prototype, { stateChange: function() { if (this.redraws > 0) this.refresh(true); } });
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lsd_rails-0.1.2 | Packages/lsd/Source/Module/Graphics/Render.js |
lsd_rails-0.1.1 | Packages/lsd/Source/Module/Graphics/Render.js |
lsd_rails-0.1 | Packages/lsd/Source/Module/Graphics/Render.js |