Browse Source

Timeline repaints when orientation is changed

css_transitions
jos 10 years ago
parent
commit
7a10407c27
2 changed files with 4 additions and 3 deletions
  1. +2
    -2
      src/timeline/Timeline.js
  2. +2
    -1
      src/timeline/component/TimeAxis.js

+ 2
- 2
src/timeline/Timeline.js View File

@ -732,7 +732,8 @@ Timeline.prototype.getWindow = function setWindow() {
* option autoResize=false * option autoResize=false
*/ */
Timeline.prototype.repaint = function repaint() { Timeline.prototype.repaint = function repaint() {
var options = this.options,
var resized = false,
options = this.options,
props = this.props, props = this.props,
dom = this.dom, dom = this.dom,
editable = options.editable.updateTime || options.editable.updateGroup; editable = options.editable.updateTime || options.editable.updateGroup;
@ -814,7 +815,6 @@ Timeline.prototype.repaint = function repaint() {
dom.bottom.style.top = (props.top.height + props.centerContainer.height) + 'px'; dom.bottom.style.top = (props.top.height + props.centerContainer.height) + 'px';
// repaint all components // repaint all components
var resized = false;
this.components.forEach(function (component) { this.components.forEach(function (component) {
resized = component.repaint() || resized; resized = component.repaint() || resized;
}); });

+ 2
- 1
src/timeline/component/TimeAxis.js View File

@ -73,6 +73,7 @@ TimeAxis.prototype.repaint = function () {
// determine the correct parent DOM element (depending on option orientation) // determine the correct parent DOM element (depending on option orientation)
var parent = (options.orientation == 'top') ? this.timeline.dom.top : this.timeline.dom.bottom; var parent = (options.orientation == 'top') ? this.timeline.dom.top : this.timeline.dom.bottom;
var parentChanged = (frame.parentNode !== parent);
// update classname // update classname
frame.className = 'timeaxis'; // TODO: add className from options if defined frame.className = 'timeaxis'; // TODO: add className from options if defined
@ -118,7 +119,7 @@ TimeAxis.prototype.repaint = function () {
parent.appendChild(frame) parent.appendChild(frame)
} }
return this._isResized();
return this._isResized() || parentChanged;
}; };
/** /**

Loading…
Cancel
Save