Implemented radio-buttons.

This commit is contained in:
Nissim Hadar 2017-10-12 11:18:18 -07:00
parent d0deaa631c
commit dc45c7af75
3 changed files with 37 additions and 18 deletions
libraries/entities/src
scripts/system/html

View file

@ -224,7 +224,7 @@ using HazePair = std::pair<const HazeMode, const QString>;
const std::array<HazePair, HAZE_MODE_ITEM_COUNT> HAZE_MODES = { {
HazePair{ HAZE_MODE_INHERIT,{ "inherit" } },
HazePair{ HAZE_MODE_DISABLED,{ "disabled" } },
HazePair{ HAZE_MODE_ENABLED,{ "range only" } }
HazePair{ HAZE_MODE_ENABLED,{ "enabled" } }
} };
QString EntityItemProperties::getHazeModeAsString() const {

View file

@ -547,14 +547,11 @@
<legend class="sub-section-header zone-group zone-section haze-section">
Haze
</legend>
<div class="zone-group zone-section haze-section property dropdown">
<label>Haze Mode</label>
<select name="SelectHazeMode" id="property-zone-haze-mode">
<option value="inherit">Inherit</option>
<option value="disabled">Disabled</option>
<option value="range only">Enabled</option>
</select>
</div>
<form>
<input type="radio" name="hazeMode" value="inherit" id="property-zone-haze-mode-inherit" checked> Inherit
<input type="radio" name="hazeMode" value="disabled" id="property-zone-haze-mode-disabled"> Off
<input type="radio" name="hazeMode" value="enabled" id="property-zone-haze-mode-enabled"> On
</form>
<fieldset class="zone-group zone-section haze-section property gen fstuple">
<div class="tuple">
<div><label>Range<span class="unit">m</span></label><input type="number" id="property-zone-haze-range" min="5" max="10000" step="5"></div>
@ -573,10 +570,6 @@
</fieldset>
</fieldset>
<fieldset class="zone-group zone-section haze-section property rgb fstuple">
<div class="zone-group zone-section haze-section property checkbox">
<input type="checkbox" id="property-zone-haze-enable-light-blend">
<label for="property-zone-haze-enable-light-blend">Enable Glare</label>
</div>
<div class="color-picker" id="property-zone-haze-blend-in-color"></div>
<legend>Haze Color</legend>
<div class="tuple">
@ -588,6 +581,10 @@
<label for="property-zone-haze-blend-in-color-blue">Blue:</label></div>
</div>
</fieldset>
<div class="zone-group zone-section haze-section property checkbox">
<input type="checkbox" id="property-zone-haze-enable-light-blend">
<label for="property-zone-haze-enable-light-blend">Enable Glare</label>
</div>
<fieldset class="zone-group zone-section haze-section property rgb fstuple">
<div class="color-picker" id="property-zone-haze-blend-out-color"></div>
<legend>Glare Color</legend>
@ -602,7 +599,7 @@
</fieldset>
<fieldset class="zone-group zone-section haze-section property gen fstuple">
<div class="tuple">
<div><label>Blend Angle<span class="unit">deg</span></label><input type="number" id="property-zone-haze-blend-angle" min="0" max="180" step="1"></div>
<div><label>Glare Angle<span class="unit">deg</span></label><input type="number" id="property-zone-haze-blend-angle" min="0" max="180" step="1"></div>
</div>
</fieldset>
<fieldset class="zone-group zone-section haze-section property gen fstuple">

View file

@ -146,6 +146,22 @@ function createEmitTextPropertyUpdateFunction(propertyName) {
};
}
function createHazeModeChangedFunction(zoneHazeModeInherit, zoneHazeModeDisabled, zoneHazeModeEnabled) {
return function() {
var hazeMode;
if (zoneHazeModeInherit.checked) {
hazeMode = 'inherit';
} else if (zoneHazeModeDisabled.checked) {
hazeMode = 'disabled';
} else if (zoneHazeModeEnabled.checked) {
hazeMode = 'enabled';
}
updateProperty('hazeMode', hazeMode);
}
}
function createEmitGroupTextPropertyUpdateFunction(group, propertyName) {
return function() {
var properties = {};
@ -657,7 +673,9 @@ function loaded() {
var elZoneKeyLightDirectionZ = document.getElementById("property-zone-key-light-direction-z");
var elZoneKeyLightAmbientURL = document.getElementById("property-zone-key-ambient-url");
var elZoneHazeMode = document.getElementById("property-zone-haze-mode");
var elZoneHazeModeInherit = document.getElementById("property-zone-haze-mode-inherit");
var elZoneHazeModeDisabled = document.getElementById("property-zone-haze-mode-disabled");
var elZoneHazeModeEnabled = document.getElementById("property-zone-haze-mode-enabled");
var elZoneHazeRange = document.getElementById("property-zone-haze-range");
var elZoneHazeBlendInColor = document.getElementById("property-zone-haze-blend-in-color");
@ -1018,8 +1036,9 @@ function loaded() {
elZoneKeyLightDirectionY.value = properties.keyLight.direction.y.toFixed(2);
elZoneKeyLightAmbientURL.value = properties.keyLight.ambientURL;
elZoneHazeMode.value = properties.hazeMode;
setDropdownText(elZoneHazeMode);
elZoneHazeModeInherit.checked = (properties.hazeMode == 'inherit');
elZoneHazeModeDisabled.checked = (properties.hazeMode == 'disabled');
elZoneHazeModeEnabled.checked = (properties.hazeMode == 'enabled');
elZoneHazeRange.value = properties.haze.hazeRange.toFixed(0);
elZoneHazeBlendInColor.style.backgroundColor = "rgb(" +
@ -1448,7 +1467,10 @@ function loaded() {
elZoneKeyLightDirectionX.addEventListener('change', zoneKeyLightDirectionChangeFunction);
elZoneKeyLightDirectionY.addEventListener('change', zoneKeyLightDirectionChangeFunction);
elZoneHazeMode.addEventListener('change', createEmitTextPropertyUpdateFunction('hazeMode'));
var hazeModeChanged = createHazeModeChangedFunction(elZoneHazeModeInherit, elZoneHazeModeDisabled, elZoneHazeModeEnabled)
elZoneHazeModeInherit.addEventListener('change', hazeModeChanged);
elZoneHazeModeDisabled.addEventListener('change', hazeModeChanged);
elZoneHazeModeEnabled.addEventListener('change', hazeModeChanged);
elZoneHazeRange.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('haze', 'hazeRange'));