[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/osm 832bce78f8 72/77: Implement proper map dragging wit
From: |
ELPA Syncer |
Subject: |
[elpa] externals/osm 832bce78f8 72/77: Implement proper map dragging with the mouse |
Date: |
Mon, 7 Mar 2022 08:58:09 -0500 (EST) |
branch: externals/osm
commit 832bce78f8cff93d4c9505ebddd9ac34eb4f44be
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Implement proper map dragging with the mouse
---
README.org | 4 +++-
osm.el | 18 +++++++++++++-----
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/README.org b/README.org
index 680287f213..0faaa05271 100644
--- a/README.org
+++ b/README.org
@@ -15,7 +15,8 @@
- Parallel fetching of tiles with curl
- Scrolling in large and small steps
-- Zooming with keys or with mouse click
+- Zooming
+- Mouse support (dragging, clicking)
- Map scale indicator
- Jump to coordinate
- Search for location by name
@@ -71,6 +72,7 @@ Key bindings in =osm-mode= buffer:
- ~<mouse-2>~: =osm-org-link-click= - Store point as Org link
- ~<mouse-3>~: =osm-bookmark-set-click= - Store point as bookmark
- ~<S-mouse-3>~: =osm-bookmark-delete-click= - Delete bookmark at point
+- ~<down-mouse-1>~: =osm-drag= - Drag the map with the mouse
- ~g~: =osm-goto= - Go to location
- ~h~: =osm-home= - Go to home location
- ~s~: =osm-search= - Search for location
diff --git a/osm.el b/osm.el
index baf26a1598..e764cfe937 100644
--- a/osm.el
+++ b/osm.el
@@ -139,7 +139,7 @@ Should be at least 7 days according to the server usage
policies."
(define-key map [mouse-2] #'osm-org-link-click)
(define-key map [mouse-3] #'osm-bookmark-set-click)
(define-key map [S-mouse-3] #'osm-bookmark-delete-click)
- (define-key map [drag-mouse-1] #'osm-drag)
+ (define-key map [down-mouse-1] #'osm-drag)
(define-key map [up] #'osm-up)
(define-key map [down] #'osm-down)
(define-key map [left] #'osm-left)
@@ -351,10 +351,18 @@ Should be at least 7 days according to the server usage
policies."
"Handle drag EVENT."
(interactive "@e")
(pcase-let ((`(,sx . ,sy) (posn-x-y (event-start event)))
- (`(,ex . ,ey) (posn-x-y (event-end event))))
- (cl-incf osm--x (- sx ex))
- (cl-incf osm--y (- sy ey))
- (osm--update)))
+ (map (make-sparse-keymap)))
+ (cl-incf sx osm--x)
+ (cl-incf sy osm--y)
+ (define-key map [mouse-movement]
+ (lambda (event)
+ (interactive "@e")
+ (pcase-let ((`(,ex . ,ey) (posn-x-y (event-start event))))
+ (setq osm--x (- sx ex)
+ osm--y (- sy ey))
+ (osm--update))))
+ (setq track-mouse 'dragging)
+ (set-transient-map map t (lambda () (setq track-mouse nil)))))
(defun osm-zoom-click (event)
"Zoom to the location of the click EVENT."
- [elpa] externals/osm 76b41f5fb5 51/77: Add keybindings, (continued)
- [elpa] externals/osm 76b41f5fb5 51/77: Add keybindings, ELPA Syncer, 2022/03/07
- [elpa] externals/osm a6335090e9 33/77: Handle multiple windows, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 2fbf12f0ef 46/77: seq is not needed, ELPA Syncer, 2022/03/07
- [elpa] externals/osm c2c7dff887 22/77: Compact server configuration, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 7ce1d26c88 67/77: Extract osm--make-tile, ELPA Syncer, 2022/03/07
- [elpa] externals/osm ff8ff68b4d 65/77: Check if bookmarks are present, ELPA Syncer, 2022/03/07
- [elpa] externals/osm cb191d426f 76/77: Version 0.2, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 8e8e4583f5 74/77: More robust mouse dragging, ELPA Syncer, 2022/03/07
- [elpa] externals/osm d776cdb343 42/77: Fix melpa issues (See https://github.com/melpa/melpa/pull/7936), ELPA Syncer, 2022/03/07
- [elpa] externals/osm 5b82b32201 28/77: Add server descriptions, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 832bce78f8 72/77: Implement proper map dragging with the mouse,
ELPA Syncer <=
- [elpa] externals/osm df844cd56b 30/77: Add osm-rename command, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 458257fa1f 19/77: Improve tile loading, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 699aae27b1 20/77: Rename osm-new to osm-home, ELPA Syncer, 2022/03/07
- [elpa] externals/osm d830691585 61/77: README: Remove wishlist, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 25621bb80e 41/77: curl add --fail argument, ELPA Syncer, 2022/03/07
- [elpa] externals/osm b300e42d9f 68/77: Add transient pin, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 28d3305bef 32/77: Improve handling of generated names, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 833793ed6c 77/77: Use grid placeholder, ELPA Syncer, 2022/03/07
- [elpa] externals/osm adc8156a70 37/77: README: Add more examples, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 7ac6f60b90 39/77: README update, ELPA Syncer, 2022/03/07