branch: externals/sketch-mode commit 2a4f3d75b4e67ac99c8f178dc61f93ffcd00276d Author: Daniel Nicolai <dalanico...@gmail.com> Commit: Daniel Nicolai <dalanico...@gmail.com>
Fix coordinate echo modeline (hampers interactive feedback) This commit fixes the coordinate echo's in the modeline. Unfortunately this hampers the interactive feedback, so (workaround): TODO create option to toggle coordinate echo --- sketch-mode.el | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/sketch-mode.el b/sketch-mode.el index 6654a18..04885d1 100644 --- a/sketch-mode.el +++ b/sketch-mode.el @@ -859,16 +859,14 @@ else return nil" :map `(((rect . ((0 . 0) . (,(dom-attr sketch-svg 'width) . ,(dom-attr sketch-svg 'height)))) ;; :map '(((rect . ((0 . 0) . (800 . 600))) sketch - (pointer - arrow - help-echo (lambda (_ _ pos) - ;; (let ((message-log-max nil) - ;; (coords (mouse-pixel-position))) - (setq sketch-cursor-position - (format "(%s, %s)" - (print (- (car coords) pos)) - (cdr coords))) - (force-mode-line-update)))))))) + (pointer arrow help-echo (lambda (_ _ pos) + (let ( + ;; (message-log-max nil) + (coords (cdr (mouse-pixel-position)))) + (setq sketch-cursor-position (format "(%s, %s)" + (- (car coords) sketch-im-x-offset) + (+ (cdr coords) sketch-im-y-offset)))) + (force-mode-line-update)))))))) (defun sketch-update (&optional lisp lisp-buffer coords) (unless sketch-mode @@ -897,16 +895,7 @@ else return nil" :map `(((rect . ((0 . 0) . (,(dom-attr sketch-svg 'width) . ,(dom-attr sketch-svg 'height)))) ;; :map '(((rect . ((0 . 0) . (800 . 600))) sketch - (pointer - text - ;; help-echo (lambda (_ _ pos) - ;; ;; (let ((message-log-max nil) - ;; ;; (coords (mouse-pixel-position))) - ;; (setq sketch-cursor-position (format "(%s, %s)" - ;; (- (car coords) pos) - ;; (cdr coords))) - ;; (force-mode-line-update)) - )))))) + (pointer arrow)))))) (defun sketch-object-preview-update (object-type node start-coords end-coords &optional event points) @@ -981,7 +970,11 @@ else return nil" (posn-object-x-y end) (sketch--snap-to-grid (posn-object-x-y end) grid-param)))) (sketch-object-preview-update object-type node start-coords end-coords) - (sketch-update nil nil (cons (car end-coords) (cdr end-coords)))))) + (sketch-update nil nil (cons (car end-coords) (cdr end-coords))) + (setq sketch-cursor-position (format "(%s, %s)" + (car end-coords) + (cdr end-coords))) + (force-mode-line-update)))) ;; (sketch-possibly-update-image sketch-svg))) (let* ((end (event-end event)) (end-coords (if (or (not snap) (string= snap "nil")) @@ -1003,7 +996,11 @@ else return nil" (push end-coords points) (cons end-coords points))) ", ")) - (sketch-update nil nil (cons (car end-coords) (cdr end-coords))))) + (sketch-update nil nil (cons (car end-coords) (cdr end-coords))) + (setq sketch-cursor-position (format "(%s, %s)" + (car end-coords) + (cdr end-coords))) + (force-mode-line-update))) ;; (sketch-possibly-update-image sketch-svg))) (let* ((end (event-end event)) (end-coords (if (or (not snap) (string= snap "nil"))