mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-06-22 04:58:40 +00:00
Merge pull request #4867 from G-Ambatte/fixDividerBug
Editor reduces when console opened
This commit is contained in:
@@ -18,8 +18,7 @@ const SplitPane = (props)=>{
|
|||||||
const [liveScroll, setLiveScroll] = useState(false);
|
const [liveScroll, setLiveScroll] = useState(false);
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
const savedPos = window.localStorage.getItem(PANE_WIDTH_KEY);
|
handleResize();
|
||||||
setDividerPos(savedPos ? limitPosition(savedPos, 0.1 * (window.innerWidth - 13), 0.9 * (window.innerWidth - 13)) : window.innerWidth / 2);
|
|
||||||
setLiveScroll(window.localStorage.getItem(LIVE_SCROLL_KEY) === 'true');
|
setLiveScroll(window.localStorage.getItem(LIVE_SCROLL_KEY) === 'true');
|
||||||
|
|
||||||
window.addEventListener('resize', handleResize);
|
window.addEventListener('resize', handleResize);
|
||||||
@@ -29,7 +28,10 @@ const SplitPane = (props)=>{
|
|||||||
const limitPosition = (x, min = 1, max = window.innerWidth - 13)=>Math.round(Math.min(max, Math.max(min, x)));
|
const limitPosition = (x, min = 1, max = window.innerWidth - 13)=>Math.round(Math.min(max, Math.max(min, x)));
|
||||||
|
|
||||||
//when resizing, the divider should grow smaller if less space is given, then grow back if the space is restored, to the original position
|
//when resizing, the divider should grow smaller if less space is given, then grow back if the space is restored, to the original position
|
||||||
const handleResize = ()=>setDividerPos(limitPosition(window.localStorage.getItem(PANE_WIDTH_KEY), 0.1 * (window.innerWidth - 13), 0.9 * (window.innerWidth - 13)));
|
const handleResize = ()=>{
|
||||||
|
const savedPos = window.localStorage.getItem(PANE_WIDTH_KEY);
|
||||||
|
setDividerPos(savedPos ? limitPosition(savedPos, 0.1 * (window.innerWidth - 13), 0.9 * (window.innerWidth - 13)) : window.innerWidth / 2);
|
||||||
|
};
|
||||||
|
|
||||||
const handleUp =(e)=>{
|
const handleUp =(e)=>{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user