Browse Source

clarified var naming

css_transitions
Alex de Mulder 10 years ago
parent
commit
d758d0e0ef
1 changed files with 9 additions and 10 deletions
  1. +9
    -10
      src/timeline/component/Linegraph.js

+ 9
- 10
src/timeline/component/Linegraph.js View File

@ -435,29 +435,28 @@ Linegraph.prototype.drawPoint = function(x, y, className, container, svg) {
return point; return point;
} }
Linegraph.prototype._getSVGElement = function (elementType, container, svg) {
Linegraph.prototype._getSVGElement = function (elementType, JSONcontainer, svgContainer) {
var element; var element;
// allocate SVG element, if it doesnt yet exist, create one. // allocate SVG element, if it doesnt yet exist, create one.
if (container.hasOwnProperty(elementType)) { // this element has been created before
if (JSONcontainer.hasOwnProperty(elementType)) { // this element has been created before
// check if there is an redundant element // check if there is an redundant element
if (container[elementType].redundant.length > 0) {
element = container[elementType].redundant[0];
container[elementType].redundant.shift()
if (JSONcontainer[elementType].redundant.length > 0) {
element = JSONcontainer[elementType].redundant[0];
JSONcontainer[elementType].redundant.shift()
} }
else { else {
// create a new element and add it to the SVG // create a new element and add it to the SVG
element = document.createElementNS('http://www.w3.org/2000/svg', elementType); element = document.createElementNS('http://www.w3.org/2000/svg', elementType);
svg.appendChild(element);
svgContainer.appendChild(element);
} }
} }
else { else {
// create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it.
element = document.createElementNS('http://www.w3.org/2000/svg', elementType); element = document.createElementNS('http://www.w3.org/2000/svg', elementType);
container[elementType] = {used: [], redundant: []};
svg.appendChild(element);
JSONcontainer[elementType] = {used: [], redundant: []};
svgContainer.appendChild(element);
} }
container[elementType].used.push(element);
JSONcontainer[elementType].used.push(element);
return element; return element;
}; };

Loading…
Cancel
Save