Browse Source

- Fixed #1461: Reset order of SVG elements in legend icons.

fixDataView
Alex de Mulder 9 years ago
parent
commit
c964fe2a54
4 changed files with 28 additions and 7 deletions
  1. +1
    -0
      HISTORY.md
  2. +14
    -4
      dist/vis.js
  3. +10
    -0
      lib/DOMutil.js
  4. +3
    -3
      lib/timeline/component/Legend.js

+ 1
- 0
HISTORY.md View File

@ -35,6 +35,7 @@ http://visjs.org
### Graph2d ### Graph2d
- Fixed #1385: Draw lines on top of bars. - Fixed #1385: Draw lines on top of bars.
- Fixed #1461: Reset order of SVG elements in legend icons.
### DataSet/DataView ### DataSet/DataView

+ 14
- 4
dist/vis.js View File

@ -5,7 +5,7 @@
* A dynamic, browser-based visualization library. * A dynamic, browser-based visualization library.
* *
* @version 4.9.1-SNAPSHOT * @version 4.9.1-SNAPSHOT
* @date 2015-11-20
* @date 2015-11-26
* *
* @license * @license
* Copyright (C) 2011-2015 Almende B.V, http://almende.com * Copyright (C) 2011-2015 Almende B.V, http://almende.com
@ -5045,6 +5045,16 @@ return /******/ (function(modules) { // webpackBootstrap
} }
}; };
/**
* Ensures that all elements are removed first up so they can be recreated cleanly
* @param JSONcontainer
*/
exports.resetElements = function (JSONcontainer) {
exports.prepareElements(JSONcontainer);
exports.cleanupElements(JSONcontainer);
exports.prepareElements(JSONcontainer);
};
/** /**
* Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer
* the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this.
@ -26684,7 +26694,9 @@ return /******/ (function(modules) { // webpackBootstrap
return a < b ? -1 : 1; return a < b ? -1 : 1;
}); });
DOMutil.prepareElements(this.svgElements);
// this resets the elements so the order is maintained
DOMutil.resetElements(this.svgElements);
var padding = window.getComputedStyle(this.dom.frame).paddingTop; var padding = window.getComputedStyle(this.dom.frame).paddingTop;
var iconOffset = Number(padding.replace('px', '')); var iconOffset = Number(padding.replace('px', ''));
var x = iconOffset; var x = iconOffset;
@ -26701,8 +26713,6 @@ return /******/ (function(modules) { // webpackBootstrap
y += iconHeight + this.options.iconSpacing; y += iconHeight + this.options.iconSpacing;
} }
} }
DOMutil.cleanupElements(this.svgElements);
} }
}; };

+ 10
- 0
lib/DOMutil.js View File

@ -36,6 +36,16 @@ exports.cleanupElements = function(JSONcontainer) {
} }
}; };
/**
* Ensures that all elements are removed first up so they can be recreated cleanly
* @param JSONcontainer
*/
exports.resetElements = function(JSONcontainer) {
exports.prepareElements(JSONcontainer);
exports.cleanupElements(JSONcontainer);
exports.prepareElements(JSONcontainer);
}
/** /**
* Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer
* the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this.

+ 3
- 3
lib/timeline/component/Legend.js View File

@ -189,7 +189,9 @@ Legend.prototype.drawLegendIcons = function() {
return (a < b ? -1 : 1); return (a < b ? -1 : 1);
}) })
DOMutil.prepareElements(this.svgElements);
// this resets the elements so the order is maintained
DOMutil.resetElements(this.svgElements);
var padding = window.getComputedStyle(this.dom.frame).paddingTop; var padding = window.getComputedStyle(this.dom.frame).paddingTop;
var iconOffset = Number(padding.replace('px','')); var iconOffset = Number(padding.replace('px',''));
var x = iconOffset; var x = iconOffset;
@ -206,8 +208,6 @@ Legend.prototype.drawLegendIcons = function() {
y += iconHeight + this.options.iconSpacing; y += iconHeight + this.options.iconSpacing;
} }
} }
DOMutil.cleanupElements(this.svgElements);
} }
}; };

Loading…
Cancel
Save