notes + minor fix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-11-04 23:15:55 +03:00
parent 6674ece80e
commit 34756613a4
3 changed files with 13 additions and 11 deletions

View File

@ -29,6 +29,8 @@ function clickPoint(x,y){
// box corresponds the to desired coordinates. This accounts for nested // box corresponds the to desired coordinates. This accounts for nested
// elements. // elements.
// //
// XXX with multi-line text when clicking outside the text to the left/right
// need to select the appropriate line...
// XXX it would be a better idea to do a binary search instead of a liner // XXX it would be a better idea to do a binary search instead of a liner
// pass... // pass...
// ...though b-search will get us to the target, we stll need to count... // ...though b-search will get us to the target, we stll need to count...

View File

@ -180,7 +180,6 @@ HTMLTextAreaElement.prototype.getTextOffsetAt = function(x, y){
r.setEnd(t, i) r.setEnd(t, i)
prev = rect prev = rect
rect = r.getBoundingClientRect() rect = r.getBoundingClientRect()
// line change... // line change...
if(prev && prev.y != rect.y){ if(prev && prev.y != rect.y){
// went off the cursor line // went off the cursor line
@ -192,21 +191,21 @@ HTMLTextAreaElement.prototype.getTextOffsetAt = function(x, y){
?? i - 1 } ?? i - 1 }
// reset col // reset col
col = undefined } col = undefined }
// cursor line... // cursor line...
cursor_line = cursor_line =
oy >= rect.y - clone.y oy >= rect.y - clone.y
&& oy <= rect.bottom - clone.y && oy <= rect.bottom - clone.y
// cursor col -- set once per line... // cursor col -- set once per line...
if(col == null if(col == null
&& ox <= rect.x - clone.x){ && ox <= rect.x - clone.x){
col = (!prev // XXX not sure about this test...
|| Math.abs(rect.x - clone.x - x) <= Math.abs(prev.x - clone.x - x)) ? col = (ox > 0
|| i == 0) ?
i i
: i - 1 : i - 1
if(cursor_line){ if(cursor_line){
return col } } } return col } } }
// below or right of the block -> return last col or last char...
return col return col
?? i } ?? i }

View File

@ -56,13 +56,9 @@ var setup = function(){
- side margins are a bit too large (account for toolbat to the right) - side margins are a bit too large (account for toolbat to the right)
- -
- ## ToDo: - ## ToDo:
- DONE selecting expanded code by _click-n-drag_
- # this is a test
string with
some extra words
- BUG: while selecting if the cursor moves to the left far enough (outside parent?) the first char in current line gets toggled...
- custom element / web component - custom element / web component
- BUG: select via click-n-drag and double/triple clicks does not work... - BUG: select via double/triple clicks does not work...
- _looks like something is refocusing the element..._
- BUG/race: the non-value versions of custom elem seem to sometimes get loaded as empty... - BUG/race: the non-value versions of custom elem seem to sometimes get loaded as empty...
- DONE data interface: - DONE data interface:
collapsed:: true collapsed:: true
@ -126,6 +122,11 @@ var setup = function(){
- `<editable/>` -- field marker - `<editable/>` -- field marker
- each child node will copy the template and allow editing of only fields - each child node will copy the template and allow editing of only fields
- not clear how to handle template changes... - not clear how to handle template changes...
- DONE selecting expanded code by _click-n-drag_
collapsed:: true
- # this is a test
string with
some extra words
- DONE `backspace`/`delete` in block contract the field with a delay... - DONE `backspace`/`delete` in block contract the field with a delay...
collapsed:: true collapsed:: true
- _...looks like we are updating size on keyup..._ - _...looks like we are updating size on keyup..._