-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mouseover highlighting is off when scrolling #91
Comments
Oh, good catch. There is a 'handleScrollEvent' method in the 'real' application event handler, that is not present in this simple application. src/application/eventHandler.ts is the code. I'll try to add it when I get a chance. It should work just to add that code to the html script in an 'onscroll' handler. You can replace |
OK this is fixed: const musicRoot = document.getElementById('outer-container');
musicRoot.onscroll = (ev) => {
view.tracker.scroller.handleScroll(musicRoot.scrollLeft, musicRoot.scrollTop);
} I also added an API in ScoreView: handleScrollEvent(leftScroll, rightScroll). So in the future you can just go |
Fixed per above. |
Thanks for the quick answer. |
I'm not sure what you mean by 'my case'. Is there a fiddle or a branch that I can see? You used the example codepen, so I am talking about the link you included above. 'outer-container' there does receive scroll events, now that I've set the overflow. The element you define when you create the application is the top level, that is the one that is scrolled. So you do have control over it. You don't have control directly over the contained div and svg, but you can control them indirectly by defining the page size, global scale and zoom level within Smoosic API. The element you define to Smoosic, 'outer-container' in the sample code, is the element that receives the scrolling events. The application creates a div that has the 'true size' of your score inside of that, based on the size of the score (page size * number of pages). The SVG element is created inside of the second div, with a viewport size determined by the zoom and global scale. You should make sure that 1) your top-level container has an ID (that you pass to the application), and 2) that it has a natural size that can be determined from the DOM. But if these were your problems, I'd expect you wouldn't see the music at all. |
Thanks for the details. |
Wow, neat. Are you going to create a natural language model for Smoosic? There can be more than one scrolling region. One overall for the notebook and one for the music div. Do you see a scroll bar around the music div? If you're not, there may be some issue with the css. If you are, then maybe the div isn't created when you try to bind the event. |
Ahah I don't know, but the integration with Python will open new possibilities for sure.
No, but maybe there should be, so that we can scroll through a large score. Anyway, if there was a scroll bar around the music div, my understanding was that the way you handle scrolling was not taking into account the scrolling of the notebook, but maybe I'm wrong? |
Even if there is no scrollbar, there is still a left/top offset from the top of the page to the music div. Smoosic assumes that never changes unless we get a screen resize event (in which case we reset the scroll object), but maybe that is not the case in the notebook. |
Yes I don't think this is the case in the notebook, see: Peek.2024-01-03.22-39.mp4 |
In the simple music editor example, if you make the container scrollable:
and scroll a little bit, you can see that the highlighting of the mouseover is off.
I'm not sure how to take into account the scrolling, do you have any idea?
The text was updated successfully, but these errors were encountered: