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

group height changed with item.top when navigate the timeline even set the heightmode with fixed #69

Open
Haiyang2017 opened this issue Nov 1, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@Haiyang2017
Copy link

Haiyang2017 commented Nov 1, 2018

set the groupHeightMode to fixed,
when navigate the timeline,the item.top will be changed and then the group height will be changed.
any solution? thx very much.

i can't run timeline in jsfiddle.
so i remake the problem in https://jshare.com.cn/temp/FptwxQ

pay attention to the "two group".

1

2

I guess, maybe sth wrong with the _calculateHeight code, because the item.top change frequently and then the group height changed. I'm not sure.

key: '_calculateHeight',
value: function _calculateHeight(margin) {
  // recalculate the height of the group
  var height = void 0;
 
  var items = void 0;

  if (this.heightMode === 'fixed') {
    items = util.toArray(this.items);
  } else {
    // default or 'auto'
    items = this.visibleItems;
  }

  if (items.length > 0) {
    var min = items[0].top;
    var max = items[0].top + items[0].height;
    util.forEach(items, function (item) {
      min = Math.min(min, item.top);
      max = Math.max(max, item.top + item.height);
    });
    if (min > margin.axis) {
      // there is an empty gap between the lowest item and the axis
      var offset = min - margin.axis;
      max -= offset;
      util.forEach(items, function (item) {
        item.top -= offset;
      });
    }
    height = max + margin.item.vertical / 2;
  } else {
    height = 0;
  }
  height = Math.max(height, this.props.label.height);

  return height;
}

specially

if (min > margin.axis) {
// there is an empty gap between the lowest item and the axis
var offset = min - margin.axis;
max -= offset;
util.forEach(items, function (item) {
item.top -= offset;
});

@Haiyang2017 Haiyang2017 changed the title group height changed when moving the timeline even set the heightmode with fixed group height changed when navigation the timeline even set the heightmode with fixed Nov 1, 2018
@Haiyang2017 Haiyang2017 changed the title group height changed when navigation the timeline even set the heightmode with fixed group height changed when navigate the timeline even set the heightmode with fixed Nov 1, 2018
@Haiyang2017 Haiyang2017 changed the title group height changed when navigate the timeline even set the heightmode with fixed group height changed with item.top when navigate the timeline even set the heightmode with fixed Nov 1, 2018
@yotamberk yotamberk added the bug Something isn't working label Nov 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants