1- /*New: util.GetPoint
1+ /*util.GetPoint: New generic keyboard-driven graphical point/pixel selector«
2+ With the return value (a point: {x,y}), we can do document.elementsFromPoint(x,y)
3+ and pinpoint the element we want without resorting to needing (wanting) the mouse.
24Usage in app:
35
46const get_point=async()=>{
@@ -16,14 +18,21 @@ Center: s
1618Then, from North (going clockwise on the qwerty keyboard):
1719w (N), e, d, c, x (S), z, a, q
1820
19- The enter key
21+ The enter key fulfills the selectPoint promise with a {x, y} point, while
22+ escape fulfills it with null.
2023
21- */
22- /*Keep it simple: If an app defines onreload, just call *that* instead of doing the
24+ Also, we could make it an automated window feature, e.g. invoked from
25+ a system-level hotkey which simply stores the lastSelectedPoint
26+ onto the Window object. This is what select_point_from_window() does,
27+ but we are currently commenting that out @FWIKNGH.
28+
29+ »*/
30+ /*Keep it simple: If an app defines onreload, just call *that* instead of doing the«
2331system default @HGLAURJF. This is for applications that have their own internal
2432development workflows. The point is that we want to keep the r_A hotkey as universal
2533as possible (i.e., no r_CA/r_CAS/ORWHATEVER hacks).
26- */
34+ »*/
35+
2736//Imports«
2837
2938const NS = LOTW ;
@@ -4195,6 +4204,19 @@ const get_all_windows=()=>{//«
41954204 return wins ;
41964205} ; //»
41974206
4207+ const select_point_from_window = async ( ) => { //«
4208+ if ( ! CWIN ) {
4209+ cwarn ( "WHAT THE HELLLLL NO CWINNNNN!?!?!?" ) ;
4210+ return ;
4211+ }
4212+ let rv = await CWIN . selectPoint ( ) ;
4213+ if ( rv ) {
4214+ rv . time = new Date ( ) . getTime ( ) ;
4215+ CWIN . lastSelectedPoint = rv ;
4216+ log ( rv ) ;
4217+ }
4218+ } ; //»
4219+
41984220//»
41994221//Folders«
42004222
@@ -8066,6 +8088,12 @@ cwarn("There was an unattached icon in ICONS!");
80668088 case "i_CAS" : return toggle_icon_display ( ) ;
80678089// case "t_CAS": return tile_windows();
80688090 case "l_CA" : return toggle_layout_mode ( ) ;
8091+ case "SPACE_CAS" :
8092+ //if (cwin) {
8093+ //FWIKNGH
8094+ // select_point_from_window();
8095+ // return;
8096+ //}
80698097 }
80708098//»
80718099
0 commit comments