question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rendering error when resizing during render()

See original GitHub issue

start index of line is greater than the end index This error occurs when the size of the rendering area is changed during browser rendering. And mobile phone rendering also has this error, I think it is similar to #373, is there any good solution?

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
JanVebcommented, Aug 28, 2022

Do you really have to resize osmd during rendering? you could easily set desired osmd zoom before calling rendering

osmd.zoom = 2
osmd.render();

Also instead of resizing osmd you could resize its parent div:

transformOrigin: '0% 0% 0px',
transform: osmdSizeTrans,

This way resizing is almost instant and you don’t have to call osmd.render(); afterwards. Just keep in mind that osmdSizeTrans has to be state variable in order to update ui when it changes. Also afterwards if you need osmd width for example, you get it by multiplying osmd width with osmdSizeTrans

let scaleScoreWidth = document.getElementById('osmdSvgPage1').width.animVal.valueInSpecifiedUnits
  setScoreWidth(scaleScoreWidth * osmdSizeTrans)

etc

https://user-images.githubusercontent.com/93236084/187059594-c729a984-78f3-403c-a5ca-b766bb7c3f32.mp4

0reactions
sschmidTUcommented, Aug 30, 2022

Yes, ideally OSMD should not be resized during rendering. You could also turn off the autoResize option. osmd.setOptions({autoResize: false})

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rendering error when resizing during render() #1206
start index of line is greater than the end index This error occurs when the size of the rendering area is changed during...
Read more >
Stage would not render correctly when resizing window #204
When using class Stage, the behaviour is reverted so it works correctly. I haven't tested manual rendering and resizing so not sure yet...
Read more >
Rendered fewer hooks than expected after each screen resize ...
After each screen resize or switching to mobile view I get error: "Error: Rendered fewer hooks than expected. This may be caused by...
Read more >
FlexGird not rendering until resize - Wijmo - GrapeCity
I am using a flex grid with tree format. It will not render the grid until a resize is done. Additionally, it will...
Read more >
Swap chain recreation - Vulkan Tutorial
One way that works: add two calls to drawFrame() in the resize callback. GLFW halts the event loop while resizing is in progress,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found