diff --git a/clog-gui.lisp b/clog-gui.lisp index bc52632..3b320dd 100644 --- a/clog-gui.lisp +++ b/clog-gui.lisp @@ -251,6 +251,22 @@ The on-window-change clog-obj received is the new window")) (sizer :accessor sizer :documentation "Window sizer clog-element") + (last-width + :accessor last-width + :initform nil + :documentation "Last width before maximize") + (last-height + :accessor last-height + :initform nil + :documentation "Last heigth before maximize") + (last-x + :accessor last-x + :initform nil + :documentation "Last x before maximize") + (last-y + :accessor last-y + :initform nil + :documentation "Last y before maximize") (on-window-can-close :accessor on-window-can-close :initform nil @@ -371,10 +387,10 @@ The on-window-change clog-obj received is the new window")) client-movement html-id) (:documentation "Create a clog-gui-window. If client-movement is t then -use jquery-ui to move/resize. When client-movement is t only on-window-move -is fired once at start of drag and on-window-move-done at end of drag and -on-window-resize at start of resize and on-window-resize-done at end of -resize.")) +use jquery-ui to move/resize and will not work on mobile. When client-movement +is t only on-window-move is fired once at start of drag and on-window-move-done +at end of drag and on-window-resize at start of resize and +on-window-resize-done at end of resize.")) (defmethod create-gui-window ((obj clog-obj) &key (title "New Window") (content "") @@ -419,9 +435,23 @@ resize.")) (setf (closer win) (attach-as-child win (format nil "~A-closer" html-id))) (setf (sizer win) (attach-as-child win (format nil "~A-sizer" html-id))) (setf (content win) (attach-as-child win (format nil "~A-body" html-id))) - (set-on-double-click (win-title win) (lambda (obj) - (setf (width win) (unit :px 800)) - (setf (height win) (unit :px 600)))) + (set-on-double-click (win-title win) + (lambda (obj) + (cond ((last-width win) + (setf (width win) (last-width win)) + (setf (height win) (last-height win)) + (setf (top win) (last-y win)) + (setf (left win) (last-x win)) + (setf (last-width win) nil)) + (t + (setf (last-x win) (left win)) + (setf (last-y win) (top win)) + (setf (last-height win) (height win)) + (setf (last-width win) (width win)) + (setf (top win) (unit :px 35)) + (setf (left win) (unit :px 0)) + (setf (width win) (unit :vw 100)) + (setf (height win) (- (inner-height (window (body app))) 30)))))) (set-on-click (closer win) (lambda (obj) (declare (ignore obj)) (when (fire-on-window-can-close win) diff --git a/clog-window.lisp b/clog-window.lisp index ff1f686..8993a11 100644 --- a/clog-window.lisp +++ b/clog-window.lisp @@ -65,7 +65,7 @@ window.")) (:documentation "Get/Setf inner height of browser window.")) (defmethod inner-height ((obj clog-window)) - (query obj "innerHeight")) + (parse-integer (query obj "innerHeight") :junk-allowed t)) (defgeneric set-inner-height (clog-window value)) @@ -81,7 +81,7 @@ window.")) (:documentation "Get/Setf inner width of browser window.")) (defmethod inner-width ((obj clog-window)) - (query obj "innerWidth")) + (parse-integer (query obj "innerWidth") :junk-allowed t)) (defgeneric set-inner-width (clog-window value)) @@ -97,7 +97,7 @@ window.")) (:documentation "Get/Setf outer height of browser window.")) (defmethod outer-height ((obj clog-window)) - (query obj "outerHeight")) + (parse-integer (query obj "outerHeight") :junk-allowed t)) (defgeneric set-outer-height (clog-window value)) @@ -113,7 +113,7 @@ window.")) (:documentation "Get/Setf outer width of browser window.")) (defmethod outer-width ((obj clog-window)) - (query obj "outerWidth")) + (parse-integer (query obj "outerWidth") :junk-allowed t)) (defgeneric set-outer-width (clog-window value)) @@ -129,7 +129,7 @@ window.")) (:documentation "Get/Setf browser window x offset from left edge.")) (defmethod x-offset ((obj clog-window)) - (query obj "pageXOffset")) + (parse-integer (query obj "pageXOffset") :junk-allowed t)) (defgeneric set-x-offset (clog-window value)) @@ -145,7 +145,7 @@ window.")) (:documentation "Get/Setf browser window y offset from top edge.")) (defmethod y-offset ((obj clog-window)) - (query obj "pageYOffset")) + (parse-integer (query obj "pageYOffset") :junk-allowed t)) (defgeneric set-y-offset (clog-window value)) @@ -161,7 +161,7 @@ window.")) (:documentation "Get/Setf browser y postion.")) (defmethod top ((obj clog-window)) - (query obj "screenY")) + (parse-integer (query obj "screenY") :junk-allowed t)) (defgeneric set-top (clog-window value)) @@ -177,7 +177,7 @@ window.")) (:documentation "Get/Setf browser x position.")) (defmethod left ((obj clog-window)) - (query obj "screenX")) + (parse-integer (query obj "screenX") :junk-allowed t)) (defgeneric set-left (clog-window value)) @@ -203,7 +203,7 @@ window.")) (:documentation "Get screen width.")) (defmethod screen-width ((obj clog-window)) - (query obj "screen.width")) + (parse-integer (query obj "screen.width") :junk-allowed t)) ;;;;;;;;;;;;;;;;;;; ;; screen-height ;; @@ -213,7 +213,7 @@ window.")) (:documentation "Get screen height.")) (defmethod screen-height ((obj clog-window)) - (query obj "screen.height")) + (parse-integer (query obj "screen.height") :junk-allowed t)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; screen-available-width ;; @@ -223,7 +223,7 @@ window.")) (:documentation "Get available screen width.")) (defmethod screen-available-width ((obj clog-window)) - (query obj "screen.availWidth")) + (parse-integer (query obj "screen.availWidth") :junk-allowed t)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; screen-available-height ;; @@ -233,7 +233,7 @@ window.")) (:documentation "Get available screen height.")) (defmethod screen-available-height ((obj clog-window)) - (query obj "screen.availHeight")) + (parse-integer (query obj "screen.availHeight") :junk-allowed t)) ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; screen-available-left ;; @@ -243,7 +243,7 @@ window.")) (:documentation "Get available screen left.")) (defmethod screen-available-left ((obj clog-window)) - (query obj "screen.availLeft")) + (parse-integer (query obj "screen.availLeft") :junk-allowed t)) ;;;;;;;;;;;;;;;;;;;;;;;;;; ;; screen-available-top ;; @@ -253,7 +253,7 @@ window.")) (:documentation "Get available screen top.")) (defmethod screen-available-top ((obj clog-window)) - (query obj "screen.availTop")) + (parse-integer (query obj "screen.availTop") :junk-allowed t)) ;;;;;;;;;;;;;;;;;;;;;;;; ;; screen-color-depth ;;