Handle full screen changes and maximize and orientation changes on mobile

This commit is contained in:
David Botton 2021-02-14 20:44:35 -05:00
parent 64d7723702
commit 38f533d51e
3 changed files with 32 additions and 1 deletions

View file

@ -208,3 +208,19 @@ clog-document object. (Private)"))
(defmethod new-line ((obj clog-document))
(execute obj (format nil "writeln('<\br>')")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; set-on-full-screen-change ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defgeneric set-on-full-screen-change (clog-document
on-full-screen-change-handler)
(:documentation "Set the ON-FULL-SCREEN-CHANGE-HANDLER for CLOG-OBJ.
If ON-FULL-SCREEN-CHANGE-HANDLER is nil unbind the event."))
(defmethod set-on-full-screen-change ((obj clog-document) handler)
(set-event obj "fullscreenchange"
(when handler
(lambda (data)
(declare (ignore data))
(funcall handler obj)))))

View file

@ -87,6 +87,18 @@
(jquery-ui "/js/jquery-ui.js"))
"Initializes clog-gui and installs a clog-gui object on connection."
(create-clog-gui clog-body)
(set-on-full-screen-change (html-document clog-body)
(lambda (obj)
(when (current-window obj)
(when (last-width (current-window obj))
(window-normalize (current-window obj))
(window-maximize (current-window obj))))))
(set-on-orientation-change (window clog-body)
(lambda (obj)
(when (current-window obj)
(when (last-width (current-window obj))
(window-normalize (current-window obj))
(window-maximize (current-window obj))))))
(when w3-css-url
(load-css (html-document clog-body) w3-css-url))
(when jquery-ui-css

View file

@ -768,7 +768,10 @@ embedded in a native template application.)"
(put generic-function)
(put-line generic-function)
(put-br generic-function)
(new-line generic-function))
(new-line generic-function)
"CLOG-Document - Events"
(set-on-full-screen-change generic-function))
(defsection @clog-navigator (:title "CLOG Navigator Objects")
"CLOG-Navigator - CLOG Navigator Objects"