From: Jason Woofenden Date: Sun, 13 Mar 2016 18:03:14 +0000 (-0400) Subject: cursor hight fits text size X-Git-Url: https://jasonwoof.com/gitweb/?p=peach-html5-editor.git;a=commitdiff_plain;h=d415d52813ae2ee5c19bb2fd183de1f6158f6d13 cursor hight fits text size --- diff --git a/editor.coffee b/editor.coffee index b78f6a0..92fc1e0 100644 --- a/editor.coffee +++ b/editor.coffee @@ -794,7 +794,12 @@ class PeachHTML5Editor @overlay.appendChild @cursor_el @cursor_visible = true @cursor_el.style.left = "#{loc.x + overlay_padding - 1}px" - @cursor_el.style.top = "#{loc.y + overlay_padding}px" + if loc.h < 5 + height = 12 + else + height = loc.h + @cursor_el.style.top = "#{loc.y + overlay_padding + Math.round(height * .07)}px" + @cursor_el.style.height = "#{Math.round height * 0.82}px" @matt cursor[0] matt: (n) -> while @matting.length > 0 diff --git a/editor_tests_compiled.html b/editor_tests_compiled.html index 276faa7..cff5d6f 100644 --- a/editor_tests_compiled.html +++ b/editor_tests_compiled.html @@ -22,7 +22,7 @@

Peach HTML5 Editor test page (compiled version)

This version of the editor test page requires that you've compiled all the source files. (Just run make).

-

HTML view. Changes here propagate when you remove your cursor (press tab or click outside)