Function: doc-view-set-slice-using-mouse

doc-view-set-slice-using-mouse is an interactive and byte-compiled function defined in doc-view.el.gz.

Signature

(doc-view-set-slice-using-mouse)

Documentation

Set the slice of the images that should be displayed.

You set the slice by pressing mouse-1 at its top-left corner and dragging it to its bottom-right corner. See also doc-view-set-slice and doc-view-reset-slice.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/doc-view.el.gz
(defvar touch-screen-simple-mouse-conversion) ; Defined in touch-screen.el.

(defun doc-view-set-slice-using-mouse ()
  "Set the slice of the images that should be displayed.
You set the slice by pressing mouse-1 at its top-left corner and
dragging it to its bottom-right corner.  See also
`doc-view-set-slice' and `doc-view-reset-slice'."
  (interactive)
  (let ((touch-screen-simple-mouse-conversion t)
        x y w h done)
    (while (not done)
      (let ((e (read-key
		(concat "Press mouse-1 at the top-left corner and "
			"drag it to the bottom-right corner!"))))
	(when (eq (car e) 'drag-mouse-1)
	  (setq x (car (posn-object-x-y (event-start e))))
	  (setq y (cdr (posn-object-x-y (event-start e))))
	  (setq w (- (car (posn-object-x-y (event-end e))) x))
	  (setq h (- (cdr (posn-object-x-y (event-end e))) y))
	  (setq done t))))
    (doc-view-set-slice x y w h)))