diff --git a/google-maps-static.el b/google-maps-static.el index 644408d..89c877a 100644 --- a/google-maps-static.el +++ b/google-maps-static.el @@ -328,12 +328,20 @@ PLIST can contains this properties: (max (min level google-maps-static-maximum-zoom) google-maps-static-minimum-zoom)) (apply 'google-maps-static-show plist))) -(defun google-maps-static-zoom-in () - "Zoom a Google map in." - (interactive) - (unless (plist-member google-maps-static-params :zoom) - (error "Current zoom level is unknown, cannot zoom in.")) - (google-maps-static-zoom (1+ (plist-get google-maps-static-params :zoom)))) +(defun google-maps-static-zoom-in (&optional arg) + "Zoom a Google map in. +If the numeric prefix argument ARG is set, zoom in this much levels." + (interactive "p") + (let* ((arg (if (> 1 arg) 1 arg)) + (current (or (plist-get google-maps-static-params :zoom) + google-maps-static-default-zoom)) + (next (if (and (<= (+ arg current) google-maps-static-maximum-zoom) + (>= (+ arg current) google-maps-static-minimum-zoom)) + (+ arg current) + google-maps-static-maximum-zoom))) + (setq google-maps-static-params + (plist-put google-maps-static-params :zoom next)) + (google-maps-static-zoom next))) (defun google-maps-static-zoom-out () "Zoom a Google map out."