Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Add animation options for zoomIn/zoomOut funtions #2830

Merged
merged 21 commits into from
Mar 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
dcb2d58
Fix redraw order
yotamberk Dec 2, 2016
582fc64
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Dec 6, 2016
f96e6bf
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Dec 8, 2016
ffa8e0e
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Dec 17, 2016
2f04345
Fix error when option is not defined
yotamberk Dec 20, 2016
3cfa8d0
Allow template labels
yotamberk Dec 22, 2016
aee0fb3
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Dec 22, 2016
4681ace
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Dec 23, 2016
e9d1ebf
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Dec 31, 2016
cd37b2d
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Dec 31, 2016
9a27aa7
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Jan 5, 2017
4982679
Add .travis.yml file
yotamberk Jan 5, 2017
b9144d3
Add experiment travis code
yotamberk Jan 5, 2017
001fd9f
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Jan 15, 2017
e504dc7
Merge branch 'develop' of https://github.com/yotamberk/vis into develop
yotamberk Jan 15, 2017
ada1c90
Fix react example
yotamberk Jan 15, 2017
3124d8e
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Jan 27, 2017
4870ad2
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Feb 11, 2017
fae21a0
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Feb 15, 2017
91c2c31
Merge branch 'develop' of https://github.com/almende/vis into develop
yotamberk Mar 4, 2017
1e8b657
Add animation options for zoomIn and zoomOut
yotamberk Mar 4, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions docs/timeline/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1439,15 +1439,21 @@ <h2 id="Methods">Methods</h2>
</tr>

<tr>
<td>zoomIn(percentage)</td>
<td>zoomIn(percentage [, options])</td>
<td>none</td>
<td>Zoom in the current visible window. The parameter <code>percentage</code> can be a <code>Number</code> and must be between 0 and 1. If the parameter value of <code>percentage</code> is null, the window will be left unchanged.
<td>Zoom in the current visible window. The parameter <code>percentage</code> can be a <code>Number</code> and must be between 0 and 1. If the parameter value of <code>percentage</code> is null, the window will be left unchanged. Available options:
<ul>
<li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.</li>
</ul>
</td>
</tr>
<tr>
<td>zoomOut(percentage)</td>
<td>zoomOut(percentage [, options])</td>
<td>none</td>
<td>Zoom out the current visible window. The parameter <code>percentage</code> can be a <code>Number</code> and must be between 0 and 1. If the parameter value of <code>percentage</code> is null, the window will be left unchanged.
<td>Zoom out the current visible window. The parameter <code>percentage</code> can be a <code>Number</code> and must be between 0 and 1. If the parameter value of <code>percentage</code> is null, the window will be left unchanged. Available options:
<ul>
<li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.</li>
</ul>
</td>
</tr>

Expand Down
28 changes: 18 additions & 10 deletions lib/timeline/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,15 @@ Core.prototype.getWindow = function() {
/**
* Zoom in the window such that given time is centered on screen.
* @param {Number} percentage - must be between [0..1]
* @param {Object} [options] Available options:
* `animation: boolean | {duration: number, easingFunction: string}`
* If true (default), the range is animated
* smoothly to the new window. An object can be
* provided to specify duration and easing function.
* Default duration is 500 ms, and default easing
* function is 'easeInOutQuad'.
*/
Core.prototype.zoomIn = function(percentage) {
Core.prototype.zoomIn = function(percentage, options) {
if (!percentage || percentage < 0 || percentage > 1) return
var range = this.getWindow();
var start = range.start.valueOf();
Expand All @@ -720,17 +727,21 @@ Core.prototype.zoomIn = function(percentage) {
var newStart = start + distance;
var newEnd = end - distance;

this.setWindow({
start : newStart,
end : newEnd
});
this.setWindow(newStart, newEnd, options);
};

/**
* Zoom out the window such that given time is centered on screen.
* @param {Number} percentage - must be between [0..1]
* @param {Object} [options] Available options:
* `animation: boolean | {duration: number, easingFunction: string}`
* If true (default), the range is animated
* smoothly to the new window. An object can be
* provided to specify duration and easing function.
* Default duration is 500 ms, and default easing
* function is 'easeInOutQuad'.
*/
Core.prototype.zoomOut = function(percentage) {
Core.prototype.zoomOut = function(percentage, options) {
if (!percentage || percentage < 0 || percentage > 1) return
var range = this.getWindow();
var start = range.start.valueOf();
Expand All @@ -739,10 +750,7 @@ Core.prototype.zoomOut = function(percentage) {
var newStart = start - interval * percentage / 2;
var newEnd = end + interval * percentage / 2;

this.setWindow({
start : newStart,
end : newEnd
});
this.setWindow(newStart, newEnd, options);
};

/**
Expand Down