diff --git a/src/Layer_Gfx_Mono_Impl.h b/src/Layer_Gfx_Mono_Impl.h index 99ad14d..df885f2 100644 --- a/src/Layer_Gfx_Mono_Impl.h +++ b/src/Layer_Gfx_Mono_Impl.h @@ -484,6 +484,21 @@ void SMLayerGFXMono::updateScrollingText(void } break; + case peekForward: + SHIFT_SCROLL_POSITION_LEFT(); + if (IS_SCROLL_POSITION_FULLY_LEFT()) { + scrollmode = peekReverse; + if (scrollcounter > 0) scrollcounter--; + } + break; + + case peekReverse: + SHIFT_SCROLL_POSITION_RIGHT(); + if (IS_SCROLL_POSITION_FULLY_RIGHT()) { + scrollmode = peekForward; + if (scrollcounter > 0) scrollcounter--; + } + break; default: case stopped: SET_SCROLL_POSITION_TO_OFFSET_FROM_LEFT(fontLeftOffset); @@ -637,11 +652,21 @@ void SMLayerGFXMono::setMinMax(void) { // TODO: handle special case - put content in fixed location if wider than window break; + case peekForward: + case peekReverse: + scrollMin = ((this->layerRotation % 2) ? this->matrixHeight : this->matrixWidth) - textWidth; + scrollMin = (scrollMin > 0) ? 0 : scrollMin; + scrollMax = 0; + + SET_SCROLL_POSITION_TO_RIGHT(); + if (scrollmode == peekReverse) + SET_SCROLL_POSITION_TO_LEFT(); + break; case stopped: case off: SET_SCROLL_POSITION_TO_OFFSET_FROM_LEFT(fontLeftOffset); - break; + break; } } @@ -659,7 +684,7 @@ void SMLayerGFXMono::stop(void) { // scrollcounter is next to zero scrollcounter = 1; // position text at the end of the cycle - if(scrollmode == bounceReverse) + if(scrollmode == bounceReverse || scrollmode == peekReverse) SET_SCROLL_POSITION_TO_RIGHT(); else SET_SCROLL_POSITION_TO_LEFT(); diff --git a/src/Layer_Scrolling_Impl.h b/src/Layer_Scrolling_Impl.h index db033e3..2400213 100644 --- a/src/Layer_Scrolling_Impl.h +++ b/src/Layer_Scrolling_Impl.h @@ -215,7 +215,17 @@ void SMLayerScrolling::setMinMax(void) { // TODO: handle special case - put content in fixed location if wider than window break; + case peekForward: + case peekReverse: + scrollMin = this->localWidth - textWidth; + scrollMin = (scrollMin > 0) ? 0 : scrollMin; + scrollMax = 0; + scrollPosition = scrollMax; + if (scrollmode == peekReverse) + scrollPosition = scrollMin; + + break; case stopped: case off: scrollMin = scrollMax = scrollPosition = 0; @@ -290,6 +300,22 @@ void SMLayerScrolling::updateScrollingText(void) { } break; + case peekForward: + scrollPosition--; + if (scrollPosition <= scrollMin) { + scrollmode = peekReverse; + if (scrollcounter > 0) scrollcounter--; + } + break; + + case peekReverse: + scrollPosition++; + if (scrollPosition >= scrollMax) { + scrollmode = peekForward; + if (scrollcounter > 0) scrollcounter--; + } + break; + default: case stopped: scrollPosition = fontLeftOffset; diff --git a/src/MatrixCommon.h b/src/MatrixCommon.h index e5068d5..da8dd23 100644 --- a/src/MatrixCommon.h +++ b/src/MatrixCommon.h @@ -1017,7 +1017,9 @@ typedef enum ScrollMode { bounceReverse = 2, stopped = 3, off = 4, - wrapForwardFromLeft = 5 + wrapForwardFromLeft = 5, + peekForward = 6, + peekReverse = 7 } ScrollMode; #ifndef SWAPint