This repository has been archived by the owner on Jul 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
On timeline loaded #3530
Merged
Merged
On timeline loaded #3530
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c1c05d5
initial trial
yotamberk 576ea87
Add onInitialDrawComplete
yotamberk f6b9779
Add docs
yotamberk c759961
Add to eventListeners examples
yotamberk 011a929
Keeping things DRY
yotamberk 907ccbd
Remove callback insertion
yotamberk 346dac2
Remove call
yotamberk 96738e0
Fix initial real first draw complete and fix comments from review
yotamberk 5a985d4
Merge branch 'develop' into on-timeline-loaded
yotamberk 78227c5
remove all <code><code>
yotamberk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,11 @@ Core.prototype._create = function (container) { | |
this._redraw(); | ||
} | ||
}.bind(this)); | ||
this.on('rangechanged', function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is a better place. |
||
if (!this.initialRangeChangeDone) { | ||
this.initialRangeChangeDone = true; | ||
} | ||
}.bind(this)); | ||
this.on('touch', this._onTouch.bind(this)); | ||
this.on('panmove', this._onDrag.bind(this)); | ||
|
||
|
@@ -319,6 +324,7 @@ Core.prototype._create = function (container) { | |
|
||
this.redrawCount = 0; | ||
this.initialDrawDone = false; | ||
this.initialRangeChangeDone = false; | ||
|
||
// attach the root panel to the provided container | ||
if (!container) throw new Error('No container provided'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,7 @@ function Timeline (container, items, groups, options) { | |
// Create the DOM, props, and emitter | ||
this._create(container); | ||
if (!options || (options && typeof options.rtl == "undefined")) { | ||
this.dom.root.style.visibility = 'hidden'; | ||
var directionFromDom, domNode = this.dom.root; | ||
while (!directionFromDom && domNode) { | ||
directionFromDom = window.getComputedStyle(domNode, null).direction; | ||
|
@@ -173,9 +174,19 @@ function Timeline (container, items, groups, options) { | |
|
||
var start = me.options.start != undefined ? me.options.start : range.min; | ||
var end = me.options.end != undefined ? me.options.end : range.max; | ||
me.setWindow(start, end, {animation: false}, this._activateOnInitialDrawDone.bind(this)); | ||
me.setWindow(start, end, {animation: false}); | ||
} else { | ||
me.fit({animation: false}, this._activateOnInitialDrawDone.bind(this)); | ||
me.fit({animation: false}); | ||
} | ||
} | ||
|
||
if (!me.initialDrawDone && me.initialRangeChangeDone) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes right. If I was just a bit clearer in my head I should have remarked on that. Make sense, not directly connected to the while-loop. |
||
me.initialDrawDone = true; | ||
me.dom.root.style.visibility = 'visible'; | ||
if (me.options.onInitialDrawComplete) { | ||
setTimeout(() => { | ||
return me.options.onInitialDrawComplete(); | ||
}, 0) | ||
} | ||
} | ||
}); | ||
|
@@ -202,16 +213,6 @@ function Timeline (container, items, groups, options) { | |
// Extend the functionality from Core | ||
Timeline.prototype = new Core(); | ||
|
||
Timeline.prototype._activateOnInitialDrawDone = function() { | ||
if (!this.initialDrawDone) { | ||
this.initialDrawDone = true; | ||
setTimeout(() => { | ||
if (this.options.onInitialDrawComplete) { | ||
return this.options.onInitialDrawComplete(); | ||
} | ||
}, 0) | ||
} | ||
} | ||
/** | ||
* Load a configurator | ||
* @return {Object} | ||
|
@@ -421,7 +422,7 @@ Timeline.prototype.focus = function(id, options) { | |
* provided to specify duration and easing function. | ||
* Default duration is 500 ms, and default easing | ||
* function is 'easeInOutQuad'. | ||
* @param {Function} callback | ||
* @param {function} [callback] | ||
*/ | ||
Timeline.prototype.fit = function (options, callback) { | ||
var animation = (options && options.animation !== undefined) ? options.animation : true; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Er, why the double
<code>
tags? It happens more often in the docs.