MCPcopy
hub / github.com/NUKnightLab/TimelineJS3 / _positionEras

Method _positionEras

src/js/timenav/TimeNav.js:413–443  ·  view source on GitHub ↗
(fast)

Source from the content-addressed store, hash-verified

411 }
412
413 _positionEras(fast) {
414
415 var era_color = 0;
416 // POSITION X
417 for (var i = 0; i < this._eras.length; i++) {
418 var pos = {
419 start: 0,
420 end: 0,
421 width: 0
422 };
423
424 pos.start = this.timescale.getPosition(this._eras[i].start_date.getTime());
425 pos.end = this.timescale.getPosition(this._eras[i].end_date.getTime());
426 pos.width = pos.end - pos.start;
427
428 if (fast) {
429 this._eras[i].setClass("tl-timeera tl-timeera-fast");
430 } else {
431 this._eras[i].setClass("tl-timeera");
432 }
433 this._eras[i].setPosition({ left: pos.start });
434 this._eras[i].setWidth(pos.width);
435
436 era_color++;
437 if (era_color > 5) {
438 era_color = 0;
439 }
440 this._eras[i].setColor(era_color);
441 };
442
443 }
444
445 /* Public
446 ================================================== */

Callers 2

_drawTimelineMethod · 0.95
_updateDrawTimelineMethod · 0.95

Calls 6

setPositionMethod · 0.80
getPositionMethod · 0.45
getTimeMethod · 0.45
setClassMethod · 0.45
setWidthMethod · 0.45
setColorMethod · 0.45

Tested by

no test coverage detected