Add zero indicators to Physics options' sliders

This commit is contained in:
David Rowe 2017-08-31 08:24:38 +12:00
parent 13ac963bcc
commit db27b97ec7
2 changed files with 35 additions and 9 deletions

View file

@ -26,17 +26,17 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="8"
inkscape:cx="-57"
inkscape:cx="-0.6875"
inkscape:cy="-8.2596372"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1828"
inkscape:window-height="1057"
inkscape:window-x="84"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
inkscape:window-width="927"
inkscape:window-height="654"
inkscape:window-x="222"
inkscape:window-y="113"
inkscape:window-maximized="0" />
<metadata
id="metadata5">
<rdf:RDF>
@ -55,7 +55,7 @@
id="layer1"
transform="translate(0,-294.35417)">
<rect
style="fill:#252525;fill-opacity:1;stroke-width:0.08262138"
style="fill:#ffffff;fill-opacity:1;stroke-width:0.08262138"
id="rect5036"
width="2.6458333"
height="0.52916664"

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -458,9 +458,23 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
newLabel: { // TODO: Rename to "label".
// Relative to barSlider.
color: UIT.colors.white
},
zeroIndicator: {
overlay: "image3d",
properties: {
url: "../assets/horizontal-rule.svg",
dimensions: { x: 0.02, y: 0.001 },
localRotation: Quat.ZERO,
color: UIT.colors.lightGrayText,
alpha: 1.0,
solid: true,
ignoreRayIntersection: true,
isFacingAvatar: false,
visible: true
}
}
},
"barSliderValue": {
"barSliderValue": { // TODO: Move to be inside barSlider.
overlay: "cube",
properties: {
dimensions: { x: 0.02, y: 0.03, z: 0.01 },
@ -473,7 +487,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
visible: true
}
},
"barSliderRemainder": {
"barSliderRemainder": { // TODO: Move to be inside barSlider.
overlay: "cube",
properties: {
dimensions: { x: 0.02, y: 0.07, z: 0.01 },
@ -2111,6 +2125,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
}
if (optionsItems[i].type === "barSlider") {
// Value and remainder bars.
optionsSliderData[i] = {};
auxiliaryProperties = Object.clone(UI_ELEMENTS.barSliderValue.properties);
auxiliaryProperties.localPosition = { x: 0, y: (-0.5 + value / 2) * properties.dimensions.y, z: 0 };
@ -2132,6 +2147,17 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
auxiliaryProperties.parentID = optionsOverlays[optionsOverlays.length - 1];
optionsSliderData[i].remainder = Overlays.addOverlay(UI_ELEMENTS.barSliderRemainder.overlay,
auxiliaryProperties);
// Zero indicator.
childProperties = Object.clone(UI_ELEMENTS.barSlider.zeroIndicator.properties);
childProperties.url = Script.resolvePath(childProperties.url);
childProperties.dimensions = {
x: properties.dimensions.x,
y: UI_ELEMENTS.barSlider.zeroIndicator.properties.dimensions.y
};
childProperties.localPosition = { x: 0, y: 0, z: properties.dimensions.z / 2 + UIT.dimensions.imageOverlayOffset };
childProperties.parentID = optionsOverlays[optionsOverlays.length - 1];
Overlays.addOverlay(UI_ELEMENTS.barSlider.zeroIndicator.overlay, childProperties);
}
if (optionsItems[i].type === "imageSlider") {