0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-03 04:02:44 +00:00

Resolve timing issue with liveScroll on linking.

Checks to see if prevProps.livescroll has a proper Bool value. If not, do not brewJump() in editor.componantSDidUpdate.
This commit is contained in:
David Bolack
2024-06-03 22:45:22 -05:00
parent ea9f9a8c36
commit 510d8f410d

View File

@@ -105,7 +105,7 @@ const Editor = createClass({
this.sourceJump();
};
if(prevProps.liveScroll != this.props.liveScroll) {
if (this.props.liveScroll) this.brewJump();
if ((prevProps.liveScroll != undefined) && (this.props.liveScroll)) this.brewJump();
};
},
@@ -328,7 +328,6 @@ const Editor = createClass({
// console.log(`Scroll to: p${targetPage}`);
const brewRenderer = window.frames['BrewRenderer'].contentDocument.getElementsByClassName('brewRenderer')[0];
const currentPos = brewRenderer.scrollTop;
if(!window.frames['BrewRenderer'].contentDocument.getElementById(`p${targetPage}`)) return;
const targetPos = window.frames['BrewRenderer'].contentDocument.getElementById(`p${targetPage}`).getBoundingClientRect().top;
const interimPos = targetPos >= 0 ? -30 : 30;