From 76253c5222d2abc0c863487c4fe538010e5ed157 Mon Sep 17 00:00:00 2001 From: ketmar Date: Thu, 8 Feb 2018 08:35:16 +0000 Subject: [PATCH] scroll marker FossilOrigin-Name: 245306b7cafffe56bcaafb819e4651fa6d5622b123e3129b52bb5545868d8405 --- xreader.d | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xreader.d b/xreader.d index 88e2f32..c46f219 100644 --- a/xreader.d +++ b/xreader.d @@ -824,6 +824,7 @@ void run () { } } // draw text page + int markerY = -666; if (laytext !is null && laytext.lineCount) { vg.beginPath(); vg.fillColor(colorText); @@ -836,16 +837,18 @@ void run () { vg.textAlign(NVGTextAlign.H.Left, NVGTextAlign.V.Baseline); LayFontStyle lastStyle; int startx = startX; + bool setColor = true; while (lidx < laytext.lineCount && drawY < GHeight) { auto ln = laytext.line(lidx); foreach (ref LayWord w; laytext.lineWords(lidx)) { - if (lastStyle != w.style) { + if (lastStyle != w.style || setColor) { if (w.style.fontface != lastStyle.fontface) vg.fontFace(laytext.fontFace(w.style.fontface)); vg.fontSize(w.style.fontsize); auto c = NVGColor(w.style.color); vg.fillColor(c); //vg.strokeColor(c); lastStyle = w.style; + setColor = false; } // line highlighting if (newYFade && newYLine == lidx) vg.fillColor(nvgLerpRGBA(colorText, colorTextHi, newYAlpha)); @@ -872,12 +875,20 @@ void run () { } if (newYFade && newYLine == lidx) vg.fillColor(NVGColor(lastStyle.color)); } + if (newYFade && newYLine == lidx) markerY = drawY; drawY += ln.h; ++lidx; } } vg.fill(); } + // draw scroll marker + if (markerY != -666) { + vg.beginPath(); + vg.fillColor(NVGColor(0.3f, 0.3f, 0.3f, newYAlpha)); + vg.rect(startX, markerY, GWidth, 2); + vg.fill(); + } // dim text if (!showShip) { if (colorDim.a != 1) { -- 2.11.4.GIT