]> git.mdlowis.com Git - archive/tide-ocaml.git/commitdiff
Updated scrollbar to adjust thumb position based on first visible position in the...
authorMichael D. Lowis <mike@mdlowis.com>
Fri, 10 Nov 2017 03:38:42 +0000 (22:38 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Fri, 10 Nov 2017 03:38:42 +0000 (22:38 -0500)
docs/Draw.html
lib/draw.ml
lib/draw.mli

index 867004a7f0d576a42e86b05799d4297e7e759403..534867c4e7f61ea341e296774ba068bf428f8d8e 100644 (file)
@@ -45,5 +45,5 @@
 <pre><span id="VALbuffer"><span class="keyword">val</span> buffer</span> : <code class="type"><a href="Draw.Cursor.html#TYPEt">Cursor.t</a> -> <a href="Buf.html#TYPEt">Buf.t</a> -> int -> int</code></pre>
 <pre><span id="VALstatus"><span class="keyword">val</span> status</span> : <code class="type"><a href="Draw.Cursor.html#TYPEt">Cursor.t</a> -> string -> unit</code></pre>
 <pre><span id="VALtags"><span class="keyword">val</span> tags</span> : <code class="type"><a href="Draw.Cursor.html#TYPEt">Cursor.t</a> -> 'a -> unit</code></pre>
-<pre><span id="VALscroll"><span class="keyword">val</span> scroll</span> : <code class="type"><a href="Draw.Cursor.html#TYPEt">Cursor.t</a> -> float -> unit</code></pre>
+<pre><span id="VALscroll"><span class="keyword">val</span> scroll</span> : <code class="type"><a href="Draw.Cursor.html#TYPEt">Cursor.t</a> -> float * float -> unit</code></pre>
 <pre><span id="VALedit"><span class="keyword">val</span> edit</span> : <code class="type"><a href="Draw.Cursor.html#TYPEt">Cursor.t</a> -> <a href="Buf.html#TYPEt">Buf.t</a> -> int -> int</code></pre></body></html>
\ No newline at end of file
index 3e803cd2952270089228d34d2e5522899c4c7803..b636ada43347cdab00f030460d23d28d20dc3065 100644 (file)
@@ -121,10 +121,13 @@ let tags csr buf =
   string "Quit Save Undo Redo Cut Copy Paste | Find " csr;
   hrule csr.width csr
 
-let scroll csr pct =
-  let thumbsz = int_of_float ((float_of_int csr.height) *. pct) in
+let scroll csr params =
+  let start, pct = params and height = float_of_int (csr.height - csr.y) in
+  let thumbsz = (height *. pct) and thumboff = (height *. start) in
+  let mcsr = Cursor.clone csr in
   rule_bkg 14 csr.height csr;
-  dark_bkg 14 (max thumbsz 5) csr;
+  mcsr.y <- mcsr.y + (int_of_float thumboff);
+  dark_bkg 14 (int_of_float (max thumbsz 5.0)) mcsr;
   csr.x <- csr.x + 14;
   vrule csr.height csr
 
index c71bf5f180a828127f0b17364ba1d4328ab3f1ce..558ab19723333bdbd098d0f43def9ae6b2d889e4 100644 (file)
@@ -26,5 +26,5 @@ val vrule : int -> Cursor.t -> unit
 
 val status : Cursor.t -> string -> unit
 val tags : Cursor.t -> Buf.t -> unit
-val scroll : Cursor.t -> float -> unit
+val scroll : Cursor.t -> (float * float) -> unit
 val edit : Cursor.t -> Buf.t -> int -> int