danzen / zimjs

ZIM JavaScript Canvas Framework - Code Creativity! Interactive Media For All.
Other
507 stars 47 forks source link

h and v scroll conflicts list & window. #40

Closed dnvs closed 4 years ago

dnvs commented 4 years ago

when some horizontal scrolling list in a vertical scrolling window .

scrolls up & down will make the masked list crazy, please help. thx.

danzen commented 4 years ago

Okay - will take a look as soon as we can. We have added it to the bugs list in Slack at https://zimjs.com/slack - you could try caching the List as the window is scrolling and uncaching it when it is not for now...

dnvs commented 4 years ago

thank you ! it looks improved when using cache. but it will show error when mouse up, may change normal after 1-2 sec, is there any event about this?

my code :

page.on("scrolling",(e) => { items.forEach(element => { if(element.enabled){ element.enabled=false; element.cache(); } }); }) page.on("pressup",(e) => { items.forEach(element => { element.enabled=true; element.uncache(); }); })

danzen commented 4 years ago

probably a timeout(200, function(){}) might do it? Not the greatest... or a rollover event on the List to activate it again?

dnvs commented 4 years ago

ok.. i modified drag and window class ,hardcode them for temprary use, it seems peace now, but hope you can fix them next version .thankyou.

danzen commented 4 years ago

Hi @dnvs - just looked into this... the stage update is being called from the slide functionality which calls zim.drag() with slide. That gives you slide snap and throwing content effect. ZIM has a Ticker which acts as a queue for all stage updates. So if anything adds a function with Ticker.add() the ticker will then run and update the stage. ZIM animate() for instance, adds to the ticker during its animation. ZIM drag() does as well. Well... ZIM drag() with slide was adding a permanent function to the Ticker. After some months of using slide, we found we wanted to know when sliding stopped so we put in a calculation and dispatch a slidestop event. At that time, we should have also removed the Ticker function and then add it again at mousedown. That is what we have now and it works well. So we have patched 10.9.0 with the update. Thank you so much for reporting the issues.

The Window still has a hover ticker... and it takes a second or so to animate the scrollbars out. We also noticed that animate() is calling updates while it is in a wait state. So we will look into that in the future.

Also... we are not really expecting scrollable content to be made in ZIM. We usually use pages and swipe between them with the Pages class. That way, the interfaces, etc. can be cached as they are swiped and otherwise they just stay in one place. I would be interested to see what you have made when you are done! And... if you want, please join us on ZIM Slack at https://zimjs.com. Cheers.

dnvs commented 4 years ago

thank you , actually i need a 'keep original width/height' horizontal list with item, so i have to modify your list code to adapt it for temporary use....

danzen commented 4 years ago

Did you try list.scale = 1/frame.scale? And still use the fit mode.