Skip to content

Commit

Permalink
add image support to statusbar, regularize voyager menu image names, …
Browse files Browse the repository at this point in the history
…add empty menu image
  • Loading branch information
ericmandel committed Feb 24, 2020
1 parent 034133f commit 4f92ca0
Show file tree
Hide file tree
Showing 36 changed files with 73 additions and 28 deletions.
1 change: 1 addition & 0 deletions images/empty.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions images/voyager/zoom_zoom.svg
14 changes: 14 additions & 0 deletions js9-allinone.css
Original file line number Diff line number Diff line change
Expand Up @@ -1662,13 +1662,27 @@ div.JS9MouseTouchHeader, div.JS9MouseTouchFooter {
padding-left: 2px;
}

.JS9StatusbarImage {
white-space:nowrap;
}

.JS9StatusbarItemNoHighlight {
border: 1px solid #D0D0D0;
}

.JS9StatusbarItemHighlight {
border: 1px solid #B5B5B5;
}

img.JS9StatusbarImageOption[name*="zoom_"]{
height: 12px;
width: 12px;
}

img.JS9StatusbarImageOption[name*="color_"]{
height: 12px;
width: 40px;
}
div.JS9SeparateContainer {
padding: 2px;
}
Expand Down
12 changes: 6 additions & 6 deletions js9-allinone.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion js9.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ JS9.globalOpts = {
mousetouchZoom: false, // use mouse wheel, pinch to zoom?
metaClickPan: true, // metaKey + click pans to mouse position?
// statusBar: ["zoom", "scale", "colormap", "wcssys"], // status display
statusBar: "zoom: $zoom; scale: $scale/$scaleclipping($scalemin,$scalemax); color: $colormap($contrast,$bias); wcs: $wcssys($wcsunits)", // status display
// statusBar: "zoom: $zoom; scale: $scale/$scaleclipping($scalemin,$scalemax); color: $colormap($contrast,$bias); wcs: $wcssys($wcsunits)", // status display
statusBar: "$img(images/voyager/zoom_1.svg) $zoom; $scale($scaleclipping); $img(images/voyager/color_$colormap.png) $colormap; $wcssys", // status display
toolbarTooltips: false, // display tooltips on toolbar?
centerDivs: ["JS9Menubar"], // divs which take part in JS9.Display.center()
resizeDivs: ["JS9Menubar", "JS9Colorbar", "JS9Toolbar", "JS9Statusbar"], // divs which take part in JS9.Display.resize()
Expand Down
2 changes: 1 addition & 1 deletion js9.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions js9plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -6089,7 +6089,6 @@ JS9.RegisterPlugin(JS9.Mef.CLASS, JS9.Mef.NAME, JS9.Mef.init,
winResize: true,
winDims: [JS9.Mef.WIDTH, JS9.Mef.HEIGHT]});


/*
* JS9 menubar to manage menubar and its menus
*/
Expand Down Expand Up @@ -8059,7 +8058,7 @@ JS9.Menubar.createMenus = function(){
s1 = JS9.globalOpts.topColormaps[i];
s2 = s1;
if( JS9.globalOpts.menuImages ){
hstr = `<div class='JS9MenubarImage' name='${s2}'><img src='images/voyager/cmap_${s2}.png' name='color_${s2}' class='JS9MenubarImage JS9MenubarImageOption' >` + `&nbsp;&nbsp;${s2}</div>`;
hstr = `<div class='JS9MenubarImage' name='${s2}'><img src='images/voyager/color_${s2}.png' name='color_${s2}' class='JS9MenubarImage JS9MenubarImageOption' onerror='this.src="images/empty.jpg"' >` + `&nbsp;&nbsp;${s2}</div>`;
items[s1] = {name: hstr, isHtmlName: true};
} else {
items[s1] = xname(s2);
Expand All @@ -8082,7 +8081,7 @@ JS9.Menubar.createMenus = function(){
if( !JS9.globalOpts.topColormaps.includes(s1) ){
s2 = s1;
if( JS9.globalOpts.menuImages ){
hstr = `<div class='JS9MenubarImage' name='${s2}'><img src='images/voyager/cmap_${s2}.png' name='color_${s2}' class='JS9MenubarImage JS9MenubarImageOption' >` + `&nbsp;&nbsp;${s2}</div>`;
hstr = `<div class='JS9MenubarImage' name='${s2}'><img src='images/voyager/color_${s2}.png' name='color_${s2}' class='JS9MenubarImage JS9MenubarImageOption' onerror='this.src="images/empty.jpg"' >` + `&nbsp;&nbsp;${s2}</div>`;
items.morecmaps.items[s1] = {name: hstr, isHtmlName: true};
} else {
items.morecmaps.items[s1] = xname(s2);
Expand Down Expand Up @@ -8319,7 +8318,7 @@ JS9.Menubar.createMenus = function(){
if( JS9.globalOpts.menuImages ){
for(i=0; i<JS9.regions.length; i++){
reg = JS9.regions[i];
items[reg] = {name: `<div class='JS9MenubarImage' name='${reg}'><img src='images/voyager/regions_${reg}.svg' name='regions_${reg}' class='JS9MenubarImage JS9MenubarImageOption' >` + `&nbsp;&nbsp;${reg}</div>`,
items[reg] = {name: `<div class='JS9MenubarImage' name='${reg}'><img src='images/voyager/regions_${reg}.svg' name='regions_${reg}' class='JS9MenubarImage JS9MenubarImageOption' onerror='this.src="images/empty.jpg"' >` + `&nbsp;&nbsp;${reg}</div>`,
isHtmlName: true};
}
} else {
Expand Down Expand Up @@ -12178,7 +12177,8 @@ JS9.Statusbar.display = function(im){
// wrap in element containers
s = `<span class='JS9StatusbarItemContainer JS9StatusbarItemNoHighlight' onmousedown='JS9.Statusbar.setup(this)' onmouseup='JS9.Statusbar.xeq(this)'>${s}</span></span>`
.replace(/: */g, ": <span class='JS9StatusbarItemValue'>")
.replace(/; */g, "</span></span>&nbsp;<span class='JS9StatusbarItemContainer JS9StatusbarItemNoHighlight' onmousedown='JS9.Statusbar.setup(this)' onmouseup='JS9.Statusbar.xeq(this)'>");
.replace(/; */g, "</span></span>&nbsp;<span class='JS9StatusbarItemContainer JS9StatusbarItemNoHighlight' onmousedown='JS9.Statusbar.setup(this)' onmouseup='JS9.Statusbar.xeq(this)'>")
.replace(/\$img\(([^()]+)\)/g, "<img src='$1' name='$1' class='JS9StatusbarImage JS9StatusbarImageOption'>");
}
this.statusContainer.html(s);
} else {
Expand Down
14 changes: 14 additions & 0 deletions js9support.css
Original file line number Diff line number Diff line change
Expand Up @@ -1661,13 +1661,27 @@ div.JS9MouseTouchHeader, div.JS9MouseTouchFooter {
padding-left: 2px;
}

.JS9StatusbarImage {
white-space:nowrap;
}

.JS9StatusbarItemNoHighlight {
border: 1px solid #D0D0D0;
}

.JS9StatusbarItemHighlight {
border: 1px solid #B5B5B5;
}

img.JS9StatusbarImageOption[name*="zoom_"]{
height: 12px;
width: 12px;
}

img.JS9StatusbarImageOption[name*="color_"]{
height: 12px;
width: 40px;
}
div.JS9SeparateContainer {
padding: 2px;
}
Expand Down
20 changes: 10 additions & 10 deletions js9usermenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,60 +111,60 @@ JS9.globalOpts.userMenuBar = [
{
"name": "colormap",
"title": "myColormaps",
"imageTitle": "images/voyager/cmap_viridis.png",
"imageTitle": "images/voyager/color_viridis.png",
"updateTitle": "image",
"options": [
{
"name": "grey",
"image": "images/voyager/cmap_grey.png",
"image": "images/voyager/color_grey.png",
"cmd": "SetColormap",
"args": ["grey"]
},
{
"name": "cool",
"image": "images/voyager/cmap_cool.png",
"image": "images/voyager/color_cool.png",
"cmd": "SetColormap",
"args": ["cool"]
},
{
"name": "heat",
"image": "images/voyager/cmap_heat.png",
"image": "images/voyager/color_heat.png",
"cmd": "SetColormap",
"args": ["heat"]
},
{
"name": "viridis",
"image": "images/voyager/cmap_viridis.png",
"image": "images/voyager/color_viridis.png",
"cmd": "SetColormap",
"args": ["viridis"]
},
{
"name": "magma",
"image": "images/voyager/cmap_magma.png",
"image": "images/voyager/color_magma.png",
"cmd": "SetColormap",
"args": ["magma"]
},
{
"name": "sls",
"image": "images/voyager/cmap_sls.png",
"image": "images/voyager/color_sls.png",
"cmd": "SetColormap",
"args": ["sls"]
},
{
"name": "red",
"image": "images/voyager/cmap_red.png",
"image": "images/voyager/color_red.png",
"cmd": "SetColormap",
"args": ["red"]
},
{
"name": "green",
"image": "images/voyager/cmap_green.png",
"image": "images/voyager/color_green.png",
"cmd": "SetColormap",
"args": ["green"]
},
{
"name": "blue",
"image": "images/voyager/cmap_blue.png",
"image": "images/voyager/color_blue.png",
"cmd": "SetColormap",
"args": ["blue"]
},
Expand Down
Loading

0 comments on commit 4f92ca0

Please sign in to comment.