Commit dc43a9eb authored by Dave Cooper's avatar Dave Cooper
Browse files

updated to support full-screen viewport

parent b6dfd4fb
......@@ -144,6 +144,10 @@ x 1. Update welcome message to reflect empty object and refer to File->New.
(body-onpageshow (when (the use-ajax?) "gdlResize();"))
(body-onresize (when (the use-ajax?) "gdlResize();"))
(body-onpageload "gdlResize();")
(menu-clear-func #'(lambda()
(the (restore-slot-default! :ui-object))
(the viewport clear!)))
(local-css-link
(with-cl-who-string ()
......@@ -215,9 +219,13 @@ x 1. Update welcome message to reflect empty object and refer to File->New.
:set-image-format-func #'(lambda(format)
(the viewport image-format-selector (set-slot! :value format)))
:set-view-func #'(lambda(view) (the viewport view-selector (set-slot! :value view)))
:clear-func #'(lambda()
(the (restore-slot-default! :ui-object))
(the viewport clear!))
:clear-func (the menu-clear-func)
;;:clear-func #'(lambda()
;;(the (restore-slot-default! :ui-object))
;;(the viewport clear!))
:update-root-func #'(lambda() (the update-root!))
:set-self-func #'(lambda() (set-self self))
:up-root-func #'(lambda() (let ((parent (the root-object parent)))
......@@ -228,6 +236,11 @@ x 1. Update welcome message to reflect empty object and refer to File->New.
:geysr self
:viewport-js-text (the viewport viewport-js-text)
:image-format-plist (the viewport image-format-plist)
:image-format-plist (list :png "PNG image"
:jpeg "jpeg image"
:x3dom "Shaded"
;;:web3d "VRML/X3D"
:svg "Wireframe")
)
......
......@@ -60,11 +60,15 @@
(defun win-pathname-string-to-ux (string)
(let ((result (glisp:replace-regexp string "\\" "/")))
(subseq result 0 (1- (length result)))))
(subseq result 0 (1- (length result)))
;;result
))
(defparameter *home* (make-pathname :name nil :type nil :defaults *load-pathname*))
(defparameter *static* nil)
(defun initialize ()
(let* ((geysr-dir
......@@ -75,7 +79,8 @@
(if geysr-dir (merge-pathnames "static/" geysr-dir)
(or (probe-file (merge-pathnames "geysr-static/" *home*))
(probe-file (merge-pathnames "../geysr-static/" *home*)))))))
(setq *static* static)
(print-variables static)
;;(setq static (win-pathname-string-to-ux (subseq static 0 (1- (length static)))))
(setq static (win-pathname-string-to-ux static))
......
......@@ -26,5 +26,5 @@
(gwl:define-package :geysr
(:export #:assembly #:viewport #:inspector #:status-object #:menu-section
#:*internal-keywords* #:*suppress-%%-messages?* #:*suppress-$$-messages?*
#:initialize))
#:initialize #:*static*))
......@@ -27,7 +27,7 @@
:input-slots
(geysr
root-object root-object-type
(vector-graphics-onclick? (not (or (member (the image-format) '(:svg :x3dom))
(eql (the digitation-mode) :select-object))))
......@@ -134,7 +134,30 @@ var menuPositionY;
// || document.getElementById('');
var can = document.getElementById('x3dom-x3dom-1-canvas') || document.getElementById('~a');
var can = document.getElementById('x3dom-x3dom-1-canvas');
var domid = document.getElementById('~a');
var obj = can || domid;
if (can) {
can.addEventListener('mousedown', function(e) {
position = getPosition (e);
if ((e.button == 0) && (e.altKey))
{
console.log(position);
can.parent.doc.onDoubleClick(can.parent.gl, position.x, position.y);
// can.parent.onDoubleClick(e);
}
})
}
var menuState = 0;
var active = 'popup-menu-visible';
......@@ -180,18 +203,28 @@ function positionMenu(e) {
vmenu.style.top = menuPositionY;
}
var mouse_pos;
if (can)
if (obj)
{
can.addEventListener('contextmenu', function(e){
obj.addEventListener('mousedown', function(e){
mouse_pos = getPosition();
});
obj.addEventListener('contextmenu', function(e){
e.preventDefault();
e.stopPropagation();
//window.scrollTo(0,0);
position = getPosition();
if (menuState == 0) {
console.log('mouse_pos: x: ' + mouse_pos.x + ' y: ' + mouse_pos.y);
console.log('position: x: ' + position.x + ' y: ' + position.y);
if ((menuState == 0) && (mouse_pos.x == position.x) && (mouse_pos.y == position.y)) {
menuState = 1;
vmenu.classList.add(active);
makeMenuBarHoverable(e);
......@@ -211,6 +244,8 @@ e.stopPropagation();
}
function inactivateMenu ()
{
menuState = 0;
......@@ -240,6 +275,7 @@ console.log ('Done running popup-menu-text...');
function x3draw ()
{
console.log('running x3draw for view-~(~a~)');
if (x3dom.type != 'undefined') x3dom.reload();
var elem = document.getElementById('view-~(~a~)');
if (elem) elem.setAttribute('set_bind', 'true');
......@@ -483,9 +519,8 @@ to call the :write-embedded-x3d-world function."))
(htm
((:span :id "x3d-viewport")
((:|X3D| :id "x3dom-1" :style "background: #d3d3d3"
:width (format nil "~apx" (the view-object page-width))
:height (format nil "~apx" (the view-object page-length))
)
:width (if (numberp (the width)) (format nil "~apx" (the width)) (the width))
:height (if (numberp (the length)) (format nil "~apx" (the length)) (the length)))
(:|Scene|
((:|navigationinfo| :|id| "navi" :|transitionTime| "0.0"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment