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

added context-menu to all format

parent 71329289
......@@ -226,7 +226,10 @@ x 1. Update welcome message to reflect empty object and refer to File->New.
:image-format (the viewport image-format-selector value)
:view (the viewport view-selector value)
:geysr self
:viewport-js-text (the viewport viewport-js-text))
:viewport-js-text (the viewport viewport-js-text)
:image-format-plist (the viewport image-format-plist)
)
(tree :type 'tree
......
......@@ -40,9 +40,8 @@
(local-assets? t)
("Keyword `:all` or list of keyword symbols.
These dropdown menus will be included in the rendering, or `:all` to include all defined ones."
included-children :all)
)
included-children :all)
image-format-plist)
:computed-slots
......@@ -124,7 +123,7 @@ function addVisible(event, level)
:objects ((nav :type 'geysr-nav :pass-down (menu-object design-mode? local-assets? included-children)))
:objects ((nav :type 'geysr-nav :pass-down (menu-object design-mode? local-assets? included-children image-format-plist)))
:functions
(
......@@ -144,9 +143,9 @@ function addVisible(event, level)
(define-object geysr-nav (menu-node)
:input-slots ((id "menu") menu-object (design-mode? nil) (local-assets? t))
:input-slots ((id "menu") menu-object (design-mode? nil) (local-assets? t) image-format-plist)
:trickle-down-slots (menu-object design-mode? local-assets?)
:trickle-down-slots (menu-object design-mode? local-assets? image-format-plist)
:objects
((logo :type 'logo-menu)
......@@ -379,6 +378,7 @@ function addVisible(event, level)
(reset-zoom-menu :type (ecase (the menu-object :image-format)
((:png :jpeg) 'menu-function-node)
((:svg :x3dom) 'immediate-function-node))
;;:label "Fit this little guy to the whole View right now!"
:label "Fit to View!"
:function-key (ecase (the menu-object :image-format)
((:png :jpeg) :reset-zoom!)
......@@ -388,6 +388,11 @@ function addVisible(event, level)
(:svg "panZoomSVG1.reset();")
(:x3dom (the menu-object viewport-js-text))))
(clear!-menu)
;;(clear!-menu-2 :type 'clear!-menu :label "Clear 2!")
;;(clear!-menu-3 :type 'clear!-menu :label "Clear 3!")
;;(clear!-menu-4 :type 'clear!-menu :label "Clear 4!")
;;(clear!-menu-5 :type 'clear!-menu :label "Clear 5!")
;;(clear!-menu-6 :type 'clear!-menu :label "Clear 6!")
(menu-divider-2 :type 'menu-divider) (graphics-format-menu)))
......@@ -428,15 +433,15 @@ function addVisible(event, level)
(define-object graphics-format-menu (menu-node)
:input-slots ((label "Graphics Format "))
:objects ((svg :type 'menu-function-node :label "SVG"
:objects ((svg :type 'menu-function-node :label (getf (the image-format-plist) :svg)
:function-key :set-image-format! :args (list :svg))
(x3dom :type 'menu-function-node :label "x3dom"
(x3dom :type 'menu-function-node :label (getf (the image-format-plist) :x3dom)
:function-key :set-image-format! :args (list :x3dom))
(png :type 'menu-function-node :label "png"
(png :type 'menu-function-node :label (getf (the image-format-plist) :png)
:function-key :set-image-format! :args (list :png))
(jpeg :type 'menu-function-node :label "jpeg"
(jpeg :type 'menu-function-node :label (getf (the image-format-plist) :jpeg)
:function-key :set-image-format! :args (list :jpeg))))
(define-object develop-menu (menu-node)
......
......@@ -96,7 +96,7 @@
(popup-menu-text
(case (the image-format-selector value)
((:x3dom :svg)
((:x3dom :svg :png :jpeg)
(format nil
"
console.log ('running popup-menu-text...');
......@@ -130,26 +130,58 @@ var menuPositionX;
var menuPositionY;
var can = document.getElementById('x3dom-x3dom-1-canvas') || document.getElementById('svg-1');
//var can = document.getElementById('x3dom-x3dom-1-canvas') || document.getElementById('svg-1')
// || document.getElementById('');
var can = document.getElementById('x3dom-x3dom-1-canvas') || document.getElementById('~a');
var menuState = 0;
var active = 'popup-menu-visible';
var vmenu = document.getElementById('~a');
function positionMenu(e) {
let popup = document.querySelector('.popup-menu');
popup.classList.remove('mode-left');
popup.classList.remove('mode-top');
menuPosition = getPosition(e);
let windowWidth = window.innerWidth;
let windowHeight = window.innerHeight;
let positionX = menuPosition.x;
let positionY = menuPosition.y;
const menuWidth = 170;
const subMenuWidth = 200;
const menuHeight = 120;
const subMenuHeight = 84;
if( positionX + menuWidth >= windowWidth ) {
positionX -= menuWidth;
}
if( positionX + menuWidth + subMenuWidth >= windowWidth ) {
popup.classList.add('mode-left');
}
menuPosition = getPosition(e);
menuPositionX = menuPosition.x + 'px';
menuPositionY = menuPosition.y + 'px';
console.log ('position-x: ' + menuPosition.x + 'position-y: ' + menuPosition.y);
console.log ('vmenu is: ' + vmenu);
vmenu.style.left = menuPositionX;
vmenu.style.top = menuPositionY;
if(positionY + menuHeight > windowHeight) {
positionY -= menuHeight;
}
if(positionY + menuHeight + subMenuHeight > windowHeight) {
popup.classList.add('mode-top');
}
menuPositionX = positionX + 'px';
menuPositionY = positionY + 'px';
console.log('position-x: ' + menuPosition.x + 'position-y: ' + menuPosition.y);
console.log('vmenu is: ' + vmenu);
vmenu.style.left = menuPositionX;
vmenu.style.top = menuPositionY;
}
if (can)
{
can.addEventListener('contextmenu', function(e){
......@@ -194,6 +226,7 @@ document.addEventListener('click', inactivateMenu);
console.log ('Done running popup-menu-text...');
"
(the dom-id)
(the menu dom-id)))))
......
......@@ -83,6 +83,24 @@
border-top-right-radius: 5px;
}
.popup-menu.mode-left #menu>ul ul ul {
left: 0;
transform: translateX( -100% );
}
.popup-menu.mode-top #menu>ul ul ul {
top: 0;
transform: translateY( -84px );
}
.popup-menu.mode-left.popup-menu.mode-top #menu>ul ul ul {
left: 0;
top: 0;
transform: translateX( -100% ) translateY( -84px );
}
#menu > ul ul > li:last-child
{
margin-bottom: 3px;
......
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