From ff5916dc8e6afcf4d2fa28c0f486b7c3a7793190 Mon Sep 17 00:00:00 2001 From: wimrijnders Date: Sat, 24 Jun 2017 14:09:50 +0200 Subject: [PATCH 1/2] Set dimensions properly of images on initialization. (#3205) * Set dimensions properly of images on initialization. Fix for #3203 Image nodes were assigned the default size on initialization, leading to very compressed images. This fix adjusts the default size as soon as the images used have been loaded. The approach for dealing with this has been adapted from `CircularImage`. * Fixed tabs --- lib/network/CachedImage.js | 1 + lib/network/modules/components/nodes/shapes/Image.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/network/CachedImage.js b/lib/network/CachedImage.js index ad640017..fde6cb05 100644 --- a/lib/network/CachedImage.js +++ b/lib/network/CachedImage.js @@ -23,6 +23,7 @@ class CachedImage { init() { if (this.initialized()) return; + this.src = this.image.src; // For same interface with Image var w = this.image.width; var h = this.image.height; diff --git a/lib/network/modules/components/nodes/shapes/Image.js b/lib/network/modules/components/nodes/shapes/Image.js index 5905f462..04b15e84 100644 --- a/lib/network/modules/components/nodes/shapes/Image.js +++ b/lib/network/modules/components/nodes/shapes/Image.js @@ -10,6 +10,17 @@ class Image extends CircleImageBase { } 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)) { this._resizeImage(); } From eec083ce9a7dab09fa42246a008d229861b6fcb5 Mon Sep 17 00:00:00 2001 From: yotamberk Date: Sat, 24 Jun 2017 15:10:07 +0300 Subject: [PATCH 2/2] Fix stacking when setting option (#3172) (#3201) * Fix redraw order * Fix error when option is not defined * Allow template labels * Add .travis.yml file * Add experiment travis code * Fix react example * created a checklist for the release process * unchecked everything * added make github release * Remove npm-debug logs * Fix setOptions restack when setting stack * Remove extra line * Fix comments from review --- lib/timeline/component/ItemSet.js | 7 ++++++- misc/RELEASE_CHECKLIST_TEMPLATE.md | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index e5e168a3..69a64153 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -634,9 +634,14 @@ ItemSet.prototype.redraw = function() { var visibleInterval = range.end - range.start; var zoomed = (visibleInterval != this.lastVisibleInterval) || (this.props.width != this.props.lastWidth); 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.lastRangeStart = range.start; + this.lastStack = options.stack; + this.lastStackSubgroups = options.stackSubgroups; + this.props.lastWidth = this.props.width; var firstGroup = this._firstGroup(); diff --git a/misc/RELEASE_CHECKLIST_TEMPLATE.md b/misc/RELEASE_CHECKLIST_TEMPLATE.md index dda85691..694b05a3 100644 --- a/misc/RELEASE_CHECKLIST_TEMPLATE.md +++ b/misc/RELEASE_CHECKLIST_TEMPLATE.md @@ -80,4 +80,4 @@ If we would merge the development branch would overwrite this. To solve this we - [ ] FORCE-Push the branches to github: `git push --force && git push --tag` - [ ] [Re-Enable branch protection](https://github.com/almende/vis/settings/branches/develop) (enable ALL checkboxes) for `develop`. -DONE! +DONE! \ No newline at end of file