-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added graying out for UI options as in #3755 #3761
Changes from 3 commits
a35a7c5
6d1836a
74c9423
0fa4ab7
399f786
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,36 +33,36 @@ | |
<div id="toolbar"> | ||
<table><tbody> | ||
<tr> | ||
<td>Light Horizon</td> | ||
<td data-bind="style: { color: lightHorizonEnabled ? '' : 'gray'}">Light Horizon</td> | ||
<td> | ||
<input type="range" min="0" max="90" step="1.0" data-bind="value: lightHorizon, valueUpdate: 'input'"> | ||
<input type="text" size="2" data-bind="value: lightHorizon"> | ||
<input type="range" min="0" max="90" step="1.0" data-bind="value: lightHorizon, valueUpdate: 'input', enable: lightHorizonEnabled"> | ||
<input type="text" size="2" data-bind="value: lightHorizon, enable: lightHorizonEnabled"> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Light Angle</td> | ||
<td data-bind="style: { color: lightAngleEnabled ? '' : 'gray'}">Light Angle</td> | ||
<td> | ||
<input type="range" min="0" max="360" step="1.0" data-bind="value: lightAngle, valueUpdate: 'input'"> | ||
<input type="text" size="2" data-bind="value: lightAngle"> | ||
<input type="range" min="0" max="360" step="1.0" data-bind="value: lightAngle, valueUpdate: 'input', enable: lightAngleEnabled"> | ||
<input type="text" size="2" data-bind="value: lightAngle, enable: lightAngleEnabled"> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Distance Limit</td> | ||
<td data-bind="style: { color: distanceEnabled ? '' : 'gray'}">Distance Limit</td> | ||
<td> | ||
<input type="range" min="100.0" max="10000.0" step="1.0" data-bind="value: distance, valueUpdate: 'input'"> | ||
<input type="text" size="2" data-bind="value: distance"> | ||
<input type="range" min="100.0" max="10000.0" step="1.0" data-bind="value: distance, valueUpdate: 'input', enable: distanceEnabled"> | ||
<input type="text" size="2" data-bind="value: distance, enable: distanceEnabled"> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Radius</td> | ||
<td data-bind="style: { color: radiusEnabled ? '' : 'gray'}">Radius</td> | ||
<td> | ||
<input type="range" min="10.0" max="1000.0" step="1.0" data-bind="value: radius, valueUpdate: 'input'"> | ||
<input type="text" size="2" data-bind="value: radius"> | ||
<input type="range" min="10.0" max="1000.0" step="1.0" data-bind="value: radius, valueUpdate: 'input', enable: radiusEnabled"> | ||
<input type="text" size="2" data-bind="value: radius, enable: radiusEnabled"> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Cascades</td> | ||
<td><select data-bind="options: cascadeOptions, value: cascades"/></td> | ||
<td data-bind="style: { color: cascadesEnabled ? '' : 'gray'}">Cascades</td> | ||
<td><select data-bind="options: cascadeOptions, value: cascades, enabled: cascadesEnabled"/></td> | ||
</tr> | ||
<tr> | ||
<td>Light Source</td> | ||
|
@@ -77,8 +77,8 @@ | |
<td><input type="checkbox" data-bind="checked: shadows"/></td> | ||
</tr> | ||
<tr> | ||
<td>Terrain Cast</td> | ||
<td><input type="checkbox" data-bind="checked: terrainCast"/></td> | ||
<td data-bind="style: { color: terrainCastEnabled ? '' : 'gray'}">Terrain Cast</td> | ||
<td><input type="checkbox" data-bind="checked: terrainCast, enabled: terrainCastEnabled"/></td> | ||
</tr> | ||
<tr> | ||
<td>Show debug</td> | ||
|
@@ -89,12 +89,16 @@ | |
<td><input type="checkbox" data-bind="checked: freeze"/></td> | ||
</tr> | ||
<tr> | ||
<td>Cascade colors</td> | ||
<td><input type="checkbox" data-bind="checked: cascadeColors"/></td> | ||
<td data-bind="style: { color: cascadeColorsEnabled ? '' : 'gray'}">Cascade colors</td> | ||
<td><input type="checkbox" data-bind="checked: cascadeColors, enabled: cascadeColorsEnabled"/></td> | ||
</tr> | ||
<tr> | ||
<td>Fit near/far</td> | ||
<td><input type="checkbox" data-bind="checked: fitNearFar"/></td> | ||
<td data-bind="style: { color: fitNearFarEnabled ? '' : 'gray'}">Fit near/far</td> | ||
<td><input type="checkbox" data-bind="checked: fitNearFar, enabled: fitNearFarEnabled"/></td> | ||
</tr> | ||
<tr> | ||
<td data-bind="style: { color: softShadowsEnabled ? '' : 'gray'}">Soft shadows</td> | ||
<td><input type="checkbox" data-bind="checked: softShadows, enabled: softShadowsEnabled"/></td> | ||
</tr> | ||
<tr> | ||
<td>Soft shadows</td> | ||
|
@@ -109,23 +113,42 @@ | |
|
||
var viewModel = { | ||
lightAngle : 0.0, | ||
lightAngleEnabled : true, | ||
lightHorizon : 0.0, | ||
lightHorizonEnabled : true, | ||
distance : 1000.0, | ||
distanceEnabled : true, | ||
radius : 200.0, | ||
radiusEnabled : true, | ||
shadows : true, | ||
terrainCast : false, | ||
terrainCastEnabled : true, | ||
debug : true, | ||
freeze : false, | ||
cascadeColors : false, | ||
cascadeColorsEnabled : true, | ||
fitNearFar : true, | ||
fitNearFarEnabled : true, | ||
softShadows : false, | ||
softShadowsEnabled : true, | ||
cascadeOptions : [1, 4], | ||
cascades : 4, | ||
cascadesEnabled : true, | ||
lightSourceOptions : ['Freeform', 'Sun', 'Fixed', 'Point'], | ||
lightSource : 'Freeform', | ||
sizeOptions : [256, 512, 1024, 2048], | ||
size : 1024 | ||
size : 1024, | ||
}; | ||
|
||
var uiOptions = { | ||
all : ['lightHorizon', 'lightAngle', 'distance', 'radius', 'terrainCast', 'cascades', 'cascadeColors', 'fitNearFar', 'softShadows'], | ||
disable : { | ||
'Freeform' : ['radius'], | ||
'Sun' : ['lightHorizon', 'lightAngle', 'radius'], | ||
'Fixed' : ['lightHorizon', 'lightAngle', 'distance', 'radius', 'cascades', 'cascadeColors', 'fitNearFar'], | ||
'Point' : ['lightHorizon', 'lightAngle', 'distance', 'cascades', 'cascadeColors', 'fitNearFar', 'softShadows'] | ||
} | ||
} | ||
|
||
Cesium.knockout.track(viewModel); | ||
var toolbar = document.getElementById('toolbar'); | ||
|
@@ -144,6 +167,7 @@ | |
Cesium.knockout.getObservable(viewModel, 'cascades').subscribe(updateShadows); | ||
Cesium.knockout.getObservable(viewModel, 'lightSource').subscribe(updateShadows); | ||
Cesium.knockout.getObservable(viewModel, 'size').subscribe(updateSettings); | ||
Cesium.knockout.getObservable(viewModel, 'softShadows').subscribe(updateShadows); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The latest shadows code that you merged in also added this line above, so you can remove this. |
||
|
||
var offset = new Cesium.Cartesian3(); | ||
|
||
|
@@ -215,6 +239,18 @@ | |
} | ||
|
||
updateSettings(); | ||
updateUI(); | ||
} | ||
|
||
function updateUI() { | ||
uiOptions.all.forEach(function(setting) { | ||
if (uiOptions.disable[viewModel.lightSource].indexOf(setting) > -1) { | ||
viewModel[setting + 'Enabled'] = false; | ||
} | ||
else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small thing, but we usually put the else on the same line. |
||
viewModel[setting + 'Enabled'] = true; | ||
} | ||
}); | ||
} | ||
|
||
var globeVisible = true; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comma.