visjs / vis-timeline

📅 Create a fully customizable, interactive timelines and 2d-graphs with items and ranges.
https://visjs.github.io/vis-timeline/
Other
1.88k stars 315 forks source link

Items bigger than visible range get removed for some reason #1573

Open Achder opened 1 year ago

Achder commented 1 year ago

Hi, I have an issue where some items larger than the current calendar range get hidden. When I scroll to the right they appear at some point.

I have found similar issues here:

I worked my way through the code and I think I was able to track it to https://github.com/visjs/vis-timeline/blob/484a793cf1ab54ee58f2c3259fa6b0537eb21c01/lib/timeline/component/Group.js#L904

I removed the following part (introduced in this PR https://github.com/visjs/vis-timeline/pull/5):

if (!this.isVisible && this.groupId != ReservedGroupIds.BACKGROUND) {
  for (let i = 0; i < oldVisibleItems.length; i++) {
    var item = oldVisibleItems[i];
    if (item.displayed) item.hide();
  }
  return visibleItems;
} 

That seems to work fine for me without breaking anything else.

@yotamberk I know this is a long shot asking about a change that is 4 years old. But could comment on this?

alexdeia commented 1 year ago

upd: fix from your snippet greatly reduce optimization and greatly slows down the timeline

I can show it on the video if you are about it. I've been struggling with this for a long time.

This example on clean example visjs-timeline. The background is hidden only if you move by the cursor. Browser scroll doesn't hide background

Video

ctbaird commented 1 year ago

I’m also experiencing this issue, it would be great if we could get a fix out. Looking through the code a bit - the RangeItem.isVisible seems fine. Maybe the Group.isGroupVisible needs a fix.

ctbaird commented 1 year ago

@Achder I think part of the issue is caused by group height being undefined between group redraws. I opened a PR to update the condition you mentioned above.

alexdeia commented 1 year ago

@ctbaird , I tried to test your PR. Unfortunately, bug is not fixed. Pay attention on background type item. Video below:

https://user-images.githubusercontent.com/1095051/230043858-9fc672ce-04a1-4ada-881e-5c16a9c50c35.mov

ctbaird commented 1 year ago

@alexdeia do you have a JSFiddle with that example?

alexdeia commented 1 year ago

I'll prepare an example and come back