Hi there,
I'm currently implementing a basic version of a "FixedBand" in the timeline,
that is a band for which you specify a "start date", a "stop date". Once
displayed, this band cannot itself be scrolled but you can double click
somewhere in it and the synchronized bands get centered on this date.
I also implemented the classic "scroll" mechansim on this fixed band
but then only the "highlight" div moves (and other bands are synchronized).
That said, it's not yet ready for a patch because it relies on a few hardcoded
informations for now and I will tackle this as soon as I can.
Nervertheless, I've changed a bit scripts/timeline.js (patch attached, based
on rev. 1623). The patch consists in 2 parts :
1. I noticed that LinearEther is able to use a "startsOn" and a "endsOn"
parameters but Timeline.createBandInfo() doesn't try to use them. The
patch looks for a "startsOn" and a "endsOn" parameter in the bandInfo
and pass them to LinearEther.
2. I create a "FixedBand" subclass of "Timeline._Band". In order to use
it easily, I changed the way Bands were instanciated.
Please let me know if I overlooked the problem or if something is wrong
with my patch. I will provide my FixedBand code as soon as it gets
tidied.
Cheers,
Adrien.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---
--- /home/src/var/simile/timeline/trunk/src/webapp/api/scripts/timeline.js 2008-10-02 07:48:42.000000000 +0200
+++ timeline.js 2008-10-23 11:19:40.000000000 +0200
@@ -23,12 +23,25 @@
var eventSource = ("eventSource" in params) ? params.eventSource : null;
- var ether = new Timeline.LinearEther({
- centersOn: ("date" in params) ? params.date : new Date(),
+ var etherParams = {
interval: SimileAjax.DateTime.gregorianUnitLengths[params.intervalUnit],
- pixelsPerInterval: params.intervalPixels,
- theme: theme
- });
+ pixelsPerInterval: params.intervalPixels
+ };
+ if ('startsOn' in params || 'endsOn' in params) {
+ if ('startsOn' in params) {
+ etherParams.startsOn = params.startsOn;
+ }
+ if ('endsOn' in params) {
+ etherParams.endsOn = params.endsOn;
+ }
+ } else {
+ if ('date' in params) {
+ etherParams.centersOn = params.date;
+ } else {
+ etherParams.centersOn = new Date();
+ }
+ }
+ var ether = new Timeline.LinearEther(etherParams);
var etherPainter = new Timeline.GregorianEtherPainter({
unit: params.intervalUnit,
@@ -337,7 +350,9 @@
*/
this._bands = [];
for (var i = 0; i < this._bandInfos.length; i++) {
- var band = new Timeline._Band(this, this._bandInfos[i], i);
+ var bandInfo = this._bandInfos[i];
+ var bandClass = bandInfo.bandClass || Timeline._Band;
+ var band = new bandClass(this, this._bandInfos[i], i);
this._bands.push(band);
}
this._distributeWidths();
@@ -415,6 +430,13 @@
*==================================================
*/
Timeline._Band = function(timeline, bandInfo, index) {
+ // hack for easier subclassing
+ if (timeline !== undefined) {
+ this.initialize(timeline, bandInfo, index);
+ }
+};
+
+Timeline._Band.prototype.initialize = function(timeline, bandInfo, index) {
this._timeline = timeline;
this._bandInfo = bandInfo;
this._index = index;