MCPcopy Create free account
hub / github.com/microsoft/SandDance / _dirtyCheck

Function _dirtyCheck

docs/app/js/sanddance-app.js:124196–124243  ·  view source on GitHub ↗

* Internal method to check dirty status and, if possible, * make targetted updates without a full rendering pass.

()

Source from the content-addressed store, hash-verified

124194 * Internal method to check dirty status and, if possible,
124195 * make targetted updates without a full rendering pass.
124196 */ _dirtyCheck () {
124197 this._dirtyAll = true;
124198 const items = this._dirty;
124199 if (!items.length || !this._dirtyID) return true;
124200 const id = ++this._dirtyID;
124201 let item, mark, type24, mdef, i1, n, o;
124202 for(i1 = 0, n = items.length; i1 < n; ++i1){
124203 item = items[i1];
124204 mark = item.mark;
124205 if (mark.marktype !== type24) {
124206 // memoize mark instance lookup
124207 type24 = mark.marktype;
124208 mdef = Marks[type24];
124209 }
124210 if (mark.zdirty && mark.dirty !== id) {
124211 this._dirtyAll = false;
124212 dirtyParents(item, id);
124213 mark.items.forEach((i)=>{
124214 i.dirty = id;
124215 });
124216 }
124217 if (mark.zdirty) continue; // handle in standard drawing pass
124218 if (item.exit) {
124219 // EXIT
124220 if (mdef.nested && mark.items.length) {
124221 // if nested mark with remaining points, update instead
124222 o = mark.items[0];
124223 if (o._svg) this._update(mdef, o._svg, o);
124224 } else if (item._svg) {
124225 // otherwise remove from DOM
124226 o = item._svg.parentNode;
124227 if (o) o.removeChild(item._svg);
124228 }
124229 item._svg = null;
124230 continue;
124231 }
124232 item = mdef.nested ? mark.items[0] : item;
124233 if (item._update === id) continue; // already visited
124234 if (!item._svg || !item._svg.ownerSVGElement) {
124235 // ENTER
124236 this._dirtyAll = false;
124237 dirtyParents(item, id);
124238 } else // IN-PLACE UPDATE
124239 this._update(mdef, item._svg, item);
124240 item._update = id;
124241 }
124242 return !this._dirtyAll;
124243 },
124244 // -- Construct & maintain scenegraph to SVG mapping ---
124245 /**
124246 * Render a set of mark items.

Callers

nothing calls this directly

Calls 2

dirtyParentsFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected