added overtravel pauses + cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-10-23 19:38:06 +03:00
parent 857c1ae9a7
commit 4c9597e27b
2 changed files with 53 additions and 12 deletions

View File

@ -1390,6 +1390,7 @@ var Outline = {
// XXX move the code here into methods/actions...
// XXX use keyboard.js...
__overtravel_timeout: undefined,
keyboard: {
// vertical navigation...
// XXX this is a bit hacky but it works -- the caret blinks at
@ -1397,6 +1398,18 @@ var Outline = {
// nice po prevent this...
ArrowUp: function(evt){
var that = this
// overtravel...
var overtravel =
this.__overtravel_timeout != null
&& this.get() === this.get(0)
this.__overtravel_timeout != null
&& clearTimeout(this.__overtravel_timeout)
this.__overtravel_timeout = setTimeout(function(){
that.__overtravel_timeout = undefined }, 100)
if(overtravel){
return }
var edited = this.get('edited')
if(edited){
var line = edited.getTextGeometry().line
@ -1408,6 +1421,18 @@ var Outline = {
this.focus('focused', -1) } },
ArrowDown: function(evt){
var that = this
// overtravel...
var overtravel =
this.__overtravel_timeout != null
&& this.get() === this.get(-1)
this.__overtravel_timeout != null
&& clearTimeout(this.__overtravel_timeout)
this.__overtravel_timeout = setTimeout(function(){
that.__overtravel_timeout = undefined }, 100)
if(overtravel){
return }
var edited = this.get('edited')
if(edited){
var {line, lines} = edited.getTextGeometry()
@ -1441,6 +1466,19 @@ var Outline = {
this.toggleCollapse(true)
: this.focus('parent') },
ArrowRight: function(evt){
var that = this
// overtravel...
var overtravel =
this.__overtravel_timeout != null
&& this.get() === this.get(-1)
this.__overtravel_timeout != null
&& clearTimeout(this.__overtravel_timeout)
this.__overtravel_timeout = setTimeout(function(){
that.__overtravel_timeout = undefined }, 100)
if(overtravel){
return }
var edited = this.get('edited')
if(edited){
// move caret to next element...

View File

@ -51,15 +51,6 @@ var setup = function(){
-
- ## ToDo:
- crop: show crop path (and depth)
- identify a block:
- DONE index (flat)
- DONE path (index)
- id
- _the id attr is done, but we still need to get the node via id_
- focus:
- DONE `<editor>.autofocus`
- DONE `focused:: true` attr (`.text(..)`/`.json(..)`/`.load(..)`)
- focusing editor -> focus focused block
- undo
collapsed:: true
- edit stack (position, action, ...)
@ -88,9 +79,9 @@ var setup = function(){
- Nerd fonts (option???)
- multiple node selection
- smooth scrolling
- _...this is more complicated that adding `behavior: "smooth"` to `.scrollIntoView(..)` as scrolling animation will get interrupted by next user input..._
- need to cancel animation of things are moving too fast...
- make this generic
- _...this is more complicated than adding `behavior: "smooth"` to `.scrollIntoView(..)` as scrolling animation will get interrupted by next user input..._
- need to cancel animation if things are moving too fast...
- make this generic (???)
- FEATURE? block templates...
collapsed:: true
- something like: `TPL: [_] <editable/> -- <editable/>`
@ -118,6 +109,18 @@ var setup = function(){
block text
- NOTE: this is only a problem if making list-items manually -- disable???
- empty item height is a bit off...
- DONE over-travel pause -- when going fast over start/end stop...
- DONE focus:
collapsed:: true
- DONE `<editor>.autofocus`
- DONE `focused:: true` attr (`.text(..)`/`.json(..)`/`.load(..)`)
- DONE focusing editor -> focus focused block
- DONE identify a block:
collapsed:: true
- DONE index (flat)
- DONE path (index)
- DONE id
- _the id attr is done, but we still need to get the node via id_
- DONE pgup/pgdown/home/end buttons
- DONE FEATURE: "crop" -- view block tree separately...
- DONE unify attr parsing