@@ -84,6 +84,9 @@ LfpDisplayCanvas::LfpDisplayCanvas (LfpDisplayNode* processor_, SplitLayouts sl,
8484 addMouseListener (this , true );
8585
8686 borderToDrag = -1 ;
87+ resizeIndicatorIsVisible = false ;
88+ resizeIndicatorIsVertical = true ;
89+ resizeIndicatorPosition = 0 ;
8790
8891 resized ();
8992
@@ -253,6 +256,53 @@ void LfpDisplayCanvas::resized()
253256 }
254257}
255258
259+ void LfpDisplayCanvas::paintOverChildren (Graphics& g)
260+ {
261+ if (! resizeIndicatorIsVisible)
262+ return ;
263+
264+ constexpr int resizeBarThickness = 4 ;
265+ const int halfThickness = resizeBarThickness / 2 ;
266+ const Colour shadowColour = Colours::black.withAlpha (0 .5f );
267+ const Colour barColour = Colour (252 , 210 , 0 ).withAlpha (0 .9f );
268+
269+ if (resizeIndicatorIsVertical)
270+ {
271+ const int x = jlimit (0 , getWidth (), resizeIndicatorPosition);
272+ const int h = getHeight () - (optionsDrawerIsOpen ? 210 : 60 );
273+ g.setColour (shadowColour);
274+ g.fillRect (x - halfThickness - 1 , 0 , resizeBarThickness + 2 , h);
275+ g.setColour (barColour);
276+ g.fillRect (x - halfThickness, 0 , resizeBarThickness, h);
277+ }
278+ else
279+ {
280+ const int y = jlimit (0 , getHeight (), resizeIndicatorPosition);
281+ g.setColour (shadowColour);
282+ g.fillRect (0 , y - halfThickness - 1 , getWidth (), resizeBarThickness + 2 );
283+ g.setColour (barColour);
284+ g.fillRect (0 , y - halfThickness, getWidth (), resizeBarThickness);
285+ }
286+ }
287+
288+ void LfpDisplayCanvas::showResizeIndicator (bool isVertical, int position)
289+ {
290+ resizeIndicatorIsVisible = true ;
291+ resizeIndicatorIsVertical = isVertical;
292+ resizeIndicatorPosition = position;
293+ repaint ();
294+ }
295+
296+ void LfpDisplayCanvas::hideResizeIndicator ()
297+ {
298+ if (! resizeIndicatorIsVisible)
299+ return ;
300+
301+ resizeIndicatorIsVisible = false ;
302+ borderToDrag = -1 ;
303+ repaint ();
304+ }
305+
256306void LfpDisplayCanvas::beginAnimation ()
257307{
258308 for (auto split : displaySplits)
@@ -314,6 +364,7 @@ void LfpDisplayCanvas::select (LfpDisplaySplitter* splitter)
314364void LfpDisplayCanvas::setLayout (SplitLayouts sl)
315365{
316366 selectedLayout = sl;
367+ hideResizeIndicator ();
317368
318369 if (! isLoading)
319370 resized ();
@@ -432,12 +483,8 @@ void LfpDisplayCanvas::mouseDrag (const MouseEvent& e)
432483
433484 if (borderToDrag == 0 )
434485 {
435- doubleVerticalSplitRatio = float (event.position .getX ()) / float (getWidth ());
436-
437- if (doubleVerticalSplitRatio < 0.15 )
438- doubleVerticalSplitRatio = 0.15 ;
439- else if (doubleVerticalSplitRatio > 0.85 )
440- doubleVerticalSplitRatio = 0.85 ;
486+ doubleVerticalSplitRatio = jlimit (0 .15f , 0 .85f , float (event.position .getX ()) / float (getWidth ()));
487+ showResizeIndicator (true , roundToInt (getWidth () * doubleVerticalSplitRatio));
441488 }
442489 }
443490 else if (selectedLayout == THREE_VERT )
@@ -461,6 +508,8 @@ void LfpDisplayCanvas::mouseDrag (const MouseEvent& e)
461508 tripleVerticalSplitRatio.set (0 , 0.15 );
462509 else if (tripleVerticalSplitRatio[0 ] > tripleVerticalSplitRatio[1 ] - 0.15 )
463510 tripleVerticalSplitRatio.set (0 , tripleVerticalSplitRatio[1 ] - 0.15 );
511+
512+ showResizeIndicator (true , roundToInt (getWidth () * tripleVerticalSplitRatio[0 ]));
464513 }
465514
466515 else if (borderToDrag == 1 )
@@ -471,6 +520,8 @@ void LfpDisplayCanvas::mouseDrag (const MouseEvent& e)
471520 tripleVerticalSplitRatio.set (1 , tripleVerticalSplitRatio[0 ] + 0.15 );
472521 else if (tripleVerticalSplitRatio[1 ] > 0.85 )
473522 tripleVerticalSplitRatio.set (1 , 0.85 );
523+
524+ showResizeIndicator (true , roundToInt (getWidth () * tripleVerticalSplitRatio[1 ]));
474525 }
475526 }
476527 else if (selectedLayout == TWO_HORZ )
@@ -485,12 +536,8 @@ void LfpDisplayCanvas::mouseDrag (const MouseEvent& e)
485536
486537 if (borderToDrag == 0 )
487538 {
488- doubleHorizontalSplitRatio = float (event.position .getY ()) / float (getHeight ());
489-
490- if (doubleHorizontalSplitRatio < 0.15 )
491- doubleHorizontalSplitRatio = 0.15 ;
492- else if (doubleHorizontalSplitRatio > 0.85 )
493- doubleHorizontalSplitRatio = 0.85 ;
539+ doubleHorizontalSplitRatio = jlimit (0 .15f , 0 .85f , float (event.position .getY ()) / float (getHeight ()));
540+ showResizeIndicator (false , roundToInt (getHeight () * doubleHorizontalSplitRatio));
494541 }
495542 }
496543 else if (selectedLayout == THREE_HORZ )
@@ -514,6 +561,8 @@ void LfpDisplayCanvas::mouseDrag (const MouseEvent& e)
514561 tripleHorizontalSplitRatio.set (0 , 0.15 );
515562 else if (tripleHorizontalSplitRatio[0 ] > tripleHorizontalSplitRatio[1 ] - 0.15 )
516563 tripleHorizontalSplitRatio.set (0 , tripleHorizontalSplitRatio[1 ] - 0.15 );
564+
565+ showResizeIndicator (false , roundToInt (getHeight () * tripleHorizontalSplitRatio[0 ]));
517566 }
518567
519568 else if (borderToDrag == 1 )
@@ -524,6 +573,8 @@ void LfpDisplayCanvas::mouseDrag (const MouseEvent& e)
524573 tripleHorizontalSplitRatio.set (1 , tripleHorizontalSplitRatio[0 ] + 0.15 );
525574 else if (tripleHorizontalSplitRatio[1 ] > 0.85 )
526575 tripleHorizontalSplitRatio.set (1 , 0.85 );
576+
577+ showResizeIndicator (false , roundToInt (getHeight () * tripleHorizontalSplitRatio[1 ]));
527578 }
528579 }
529580}
@@ -535,6 +586,8 @@ void LfpDisplayCanvas::mouseUp (const MouseEvent& e)
535586 resized ();
536587 borderToDrag = -1 ;
537588 }
589+
590+ hideResizeIndicator ();
538591}
539592
540593void LfpDisplayCanvas::toggleOptionsDrawer (bool isOpen)
0 commit comments