Merge branch 'master' of github.com:highfidelity/hifi into punk

This commit is contained in:
sam gateau 2018-12-03 08:49:44 -08:00
commit 5af24aa7d9
3 changed files with 32 additions and 17 deletions

View file

@ -916,7 +916,7 @@ div.refresh input[type="button"] {
} }
.draggable-number div { .draggable-number div {
height: 28px; height: 28px;
width: 92px; width: 124px;
} }
.draggable-number.text { .draggable-number.text {
display: inline-block; display: inline-block;
@ -929,6 +929,7 @@ div.refresh input[type="button"] {
height: 28px; height: 28px;
width: 100%; width: 100%;
line-height: 2; line-height: 2;
box-sizing: border-box;
} }
.draggable-number.text:hover { .draggable-number.text:hover {
cursor: ew-resize; cursor: ew-resize;
@ -944,12 +945,12 @@ div.refresh input[type="button"] {
cursor: default; cursor: default;
} }
.draggable-number.left-arrow { .draggable-number.left-arrow {
top: -5px; top: 3px;
left: 0px; left: 0px;
transform: rotate(180deg); transform: rotate(180deg);
} }
.draggable-number.right-arrow { .draggable-number.right-arrow {
top: -5px; top: 3px;
right: 0px; right: 0px;
} }
.draggable-number input[type=number] { .draggable-number input[type=number] {
@ -971,14 +972,14 @@ div.refresh input[type="button"] {
left: 12px; left: 12px;
} }
.draggable-number.fstuple + .draggable-number.fstuple { .draggable-number.fstuple + .draggable-number.fstuple {
padding-left: 28px; margin-left: 28px;
} }
.draggable-number.fstuple input { .draggable-number.fstuple input {
right: -10px; right: -10px;
} }
.draggable-number.fstuple .sublabel { .draggable-number.fstuple .sublabel {
position: absolute; position: absolute;
top: 0; top: 6px;
left: -16px; left: -16px;
font-family: FiraSans-SemiBold; font-family: FiraSans-SemiBold;
font-size: 15px; font-size: 15px;

View file

@ -23,6 +23,20 @@ function DraggableNumber(min, max, step, decimals, dragStart, dragEnd) {
} }
DraggableNumber.prototype = { DraggableNumber.prototype = {
showInput: function() {
this.elText.style.visibility = "hidden";
this.elLeftArrow.style.visibility = "hidden";
this.elRightArrow.style.visibility = "hidden";
this.elInput.style.opacity = 1;
},
hideInput: function() {
this.elText.style.visibility = "visible";
this.elLeftArrow.style.visibility = "visible";
this.elRightArrow.style.visibility = "visible";
this.elInput.style.opacity = 0;
},
mouseDown: function(event) { mouseDown: function(event) {
if (event.target === this.elText) { if (event.target === this.elText) {
this.initialMouseEvent = event; this.initialMouseEvent = event;
@ -36,8 +50,8 @@ DraggableNumber.prototype = {
if (event.target === this.elText && this.initialMouseEvent) { if (event.target === this.elText && this.initialMouseEvent) {
let dx = event.clientX - this.initialMouseEvent.clientX; let dx = event.clientX - this.initialMouseEvent.clientX;
if (Math.abs(dx) <= DELTA_X_FOCUS_THRESHOLD) { if (Math.abs(dx) <= DELTA_X_FOCUS_THRESHOLD) {
this.elInput.style.visibility = "visible"; this.showInput();
this.elText.style.visibility = "hidden"; this.elInput.focus();
} }
this.initialMouseEvent = null; this.initialMouseEvent = null;
} }
@ -125,9 +139,8 @@ DraggableNumber.prototype = {
this.setValue(this.elInput.value); this.setValue(this.elInput.value);
}, },
inputBlur: function() { inputBlur: function(ev) {
this.elInput.style.visibility = "hidden"; this.hideInput();
this.elText.style.visibility = "visible";
}, },
initialize: function() { initialize: function() {
@ -171,13 +184,14 @@ DraggableNumber.prototype = {
if (this.step !== undefined) { if (this.step !== undefined) {
this.elInput.setAttribute("step", this.step); this.elInput.setAttribute("step", this.step);
} }
this.elInput.style.visibility = "hidden"; this.elInput.style.opacity = 0;
this.elInput.addEventListener("change", this.onInputChange); this.elInput.addEventListener("change", this.onInputChange);
this.elInput.addEventListener("blur", this.onInputBlur); this.elInput.addEventListener("blur", this.onInputBlur);
this.elInput.addEventListener("focus", this.showInput.bind(this));
this.elText.appendChild(this.elLeftArrow); this.elDiv.appendChild(this.elLeftArrow);
this.elText.appendChild(this.elInput); this.elDiv.appendChild(this.elInput);
this.elText.appendChild(this.elRightArrow); this.elDiv.appendChild(this.elRightArrow);
this.elDiv.appendChild(this.elText); this.elDiv.appendChild(this.elText);
} }
}; };

View file

@ -197,7 +197,7 @@ const GROUPS = [
multiplier: DEGREES_TO_RADIANS, multiplier: DEGREES_TO_RADIANS,
decimals: 2, decimals: 2,
unit: "deg", unit: "deg",
propertyID: "keyLight.direction.x", propertyID: "keyLight.direction.y",
showPropertyRule: { "keyLightMode": "enabled" }, showPropertyRule: { "keyLightMode": "enabled" },
}, },
{ {
@ -206,7 +206,7 @@ const GROUPS = [
multiplier: DEGREES_TO_RADIANS, multiplier: DEGREES_TO_RADIANS,
decimals: 2, decimals: 2,
unit: "deg", unit: "deg",
propertyID: "keyLight.direction.y", propertyID: "keyLight.direction.x",
showPropertyRule: { "keyLightMode": "enabled" }, showPropertyRule: { "keyLightMode": "enabled" },
}, },
{ {
@ -2149,7 +2149,7 @@ function createTupleNumberInput(property, subLabel) {
propertyData.decimals, dragStartFunction, dragEndFunction); propertyData.decimals, dragStartFunction, dragEndFunction);
elDraggableNumber.elInput.setAttribute("id", elementID); elDraggableNumber.elInput.setAttribute("id", elementID);
elDraggableNumber.elDiv.className += " fstuple"; elDraggableNumber.elDiv.className += " fstuple";
elDraggableNumber.elText.insertBefore(elLabel, elDraggableNumber.elLeftArrow); elDraggableNumber.elDiv.insertBefore(elLabel, elDraggableNumber.elLeftArrow);
return elDraggableNumber; return elDraggableNumber;
} }