Browse Source

Merge branch 'develop' of https://github.com/almende/vis into develop

revert-3409-performance
Yotam Berkowitz 7 years ago
parent
commit
d3c2008b49
3 changed files with 18 additions and 1 deletions
  1. +1
    -0
      lib/network/CachedImage.js
  2. +11
    -0
      lib/network/modules/components/nodes/shapes/Image.js
  3. +6
    -1
      lib/timeline/component/ItemSet.js

+ 1
- 0
lib/network/CachedImage.js View File

@ -23,6 +23,7 @@ class CachedImage {
init() { init() {
if (this.initialized()) return; if (this.initialized()) return;
this.src = this.image.src; // For same interface with Image
var w = this.image.width; var w = this.image.width;
var h = this.image.height; var h = this.image.height;

+ 11
- 0
lib/network/modules/components/nodes/shapes/Image.js View File

@ -10,6 +10,17 @@ class Image extends CircleImageBase {
} }
resize(ctx, selected = this.selected, hover = this.hover) { resize(ctx, selected = this.selected, hover = this.hover) {
var imageAbsent = (this.imageObj.src === undefined) ||
(this.imageObj.width === undefined) ||
(this.imageObj.height === undefined);
if (imageAbsent) {
var side = this.options.size * 2;
this.width = side;
this.height = side;
return;
}
if (this.needsRefresh(selected, hover)) { if (this.needsRefresh(selected, hover)) {
this._resizeImage(); this._resizeImage();
} }

+ 6
- 1
lib/timeline/component/ItemSet.js View File

@ -634,9 +634,14 @@ ItemSet.prototype.redraw = function() {
var visibleInterval = range.end - range.start; var visibleInterval = range.end - range.start;
var zoomed = (visibleInterval != this.lastVisibleInterval) || (this.props.width != this.props.lastWidth); var zoomed = (visibleInterval != this.lastVisibleInterval) || (this.props.width != this.props.lastWidth);
var scrolled = range.start != this.lastRangeStart; var scrolled = range.start != this.lastRangeStart;
var forceRestack = (zoomed || scrolled);
var changedStackOption = options.stack != this.lastStack
var changedStackSubgroupsOption = options.stackSubgroups != this.lastStackSubgroups
var forceRestack = (zoomed || scrolled || changedStackOption || changedStackSubgroupsOption);
this.lastVisibleInterval = visibleInterval; this.lastVisibleInterval = visibleInterval;
this.lastRangeStart = range.start; this.lastRangeStart = range.start;
this.lastStack = options.stack;
this.lastStackSubgroups = options.stackSubgroups;
this.props.lastWidth = this.props.width; this.props.lastWidth = this.props.width;
var firstGroup = this._firstGroup(); var firstGroup = this._firstGroup();

Loading…
Cancel
Save