mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
styling fixes, add icon, adjust Types text, click outside to close
This commit is contained in:
parent
4883a60afc
commit
97438a08d9
3 changed files with 165 additions and 90 deletions
|
@ -1036,38 +1036,74 @@ textarea:enabled[scrolling="true"]::-webkit-resizer {
|
|||
padding-bottom: 24px;
|
||||
}
|
||||
|
||||
#filter-type-multiselect {
|
||||
position: relative;
|
||||
#filter-area .multiselect {
|
||||
position: relative;
|
||||
}
|
||||
#filter-type-selectBox {
|
||||
position: absolute;
|
||||
#filter-area .selectBox {
|
||||
position: absolute;
|
||||
}
|
||||
#filter-type-selectBox select {
|
||||
font-weight: bold;
|
||||
font-family: FiraSans-SemiBold;
|
||||
color: #404040;
|
||||
background-color: #afafaf;
|
||||
#filter-area .selectBox select {
|
||||
font-family: FiraSans-SemiBold;
|
||||
font-size: 15px;
|
||||
color: #afafaf;
|
||||
background-color: #252525;
|
||||
border: none;
|
||||
height: 28px;
|
||||
width: 107px;
|
||||
text-align-last: center;
|
||||
}
|
||||
#filter-area .overSelect {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
#filter-type-checkboxes {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
display: none;
|
||||
border: 1px #dadada solid;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
top: 15px;
|
||||
display: none;
|
||||
border: none;
|
||||
}
|
||||
#filter-type-checkboxes div {
|
||||
height: 19px;
|
||||
}
|
||||
#filter-type-checkboxes span {
|
||||
font-family: hifi-glyphs;
|
||||
font-size: 16px;
|
||||
color: #404040;
|
||||
padding: 12px 12px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#filter-type-checkboxes label {
|
||||
display: block;
|
||||
font-family: FiraSans-SemiBold;
|
||||
color: #404040;
|
||||
background-color: #afafaf;
|
||||
display: block;
|
||||
font-family: FiraSans-SemiBold;
|
||||
color: #404040;
|
||||
background-color: #afafaf;
|
||||
padding: 0 20px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#filter-type-checkboxes label:hover {
|
||||
background-color: #1e90ff;
|
||||
background-color: #1e90ff;
|
||||
}
|
||||
#filter-type-checkboxes input[type=checkbox] {
|
||||
display: block;
|
||||
position: relative;
|
||||
top: 17px;
|
||||
right: -10px;
|
||||
}
|
||||
#filter-type-checkboxes input[type=checkbox] + label {
|
||||
background-image: none;
|
||||
}
|
||||
#filter-type-checkboxes input[type=checkbox]:checked + label {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
#filter-search-and-icon {
|
||||
position: absolute;
|
||||
left: 100px;
|
||||
width: 60%;
|
||||
position: absolute;
|
||||
left: 120px;
|
||||
width: calc(100% - 300px);
|
||||
}
|
||||
|
||||
#filter-in-view {
|
||||
|
@ -1076,7 +1112,7 @@ textarea:enabled[scrolling="true"]::-webkit-resizer {
|
|||
}
|
||||
|
||||
#filter-radius-and-unit {
|
||||
position: relative;
|
||||
position: relative;
|
||||
float: right;
|
||||
margin-right: -168px;
|
||||
top: -17px;
|
||||
|
|
|
@ -31,9 +31,12 @@
|
|||
</div>
|
||||
<div id="entity-list">
|
||||
<div id="filter-area">
|
||||
<div class="filter-type-multiselect">
|
||||
<div class="multiselect">
|
||||
<div class="selectBox" id="filter-type-selectBox">
|
||||
<select><option>Types...</option></select>
|
||||
<select>
|
||||
<option id="filter-type-text">All Types</option>
|
||||
</select>
|
||||
<div class="overSelect"></div>
|
||||
</div>
|
||||
<div id="filter-type-checkboxes">
|
||||
<!-- each type checkbox/label is added at runtime in entityList -->
|
||||
|
|
|
@ -60,17 +60,29 @@ const COMPARE_DESCENDING = function(a, b) {
|
|||
}
|
||||
|
||||
const FILTER_TYPES = [
|
||||
"Shape",
|
||||
"Model",
|
||||
"Image",
|
||||
"Light",
|
||||
"Zone",
|
||||
"Web",
|
||||
"Material",
|
||||
"ParticleEffect",
|
||||
"Text",
|
||||
"Shape",
|
||||
"Model",
|
||||
"Image",
|
||||
"Light",
|
||||
"Zone",
|
||||
"Web",
|
||||
"Material",
|
||||
"ParticleEffect",
|
||||
"Text",
|
||||
];
|
||||
|
||||
const ICON_FOR_TYPE = {
|
||||
Shape: "n",
|
||||
Model: "",
|
||||
Image: "",
|
||||
Light: "p",
|
||||
Zone: "o",
|
||||
Web: "q",
|
||||
Material: "",
|
||||
ParticleEffect: "",
|
||||
Text: "l",
|
||||
};
|
||||
|
||||
// List of all entities
|
||||
var entities = []
|
||||
// List of all entities, indexed by Entity ID
|
||||
|
@ -118,8 +130,9 @@ function loaded() {
|
|||
elToggleLocked = document.getElementById("locked");
|
||||
elToggleVisible = document.getElementById("visible");
|
||||
elDelete = document.getElementById("delete");
|
||||
elFilterTypeSelectBox = document.getElementById("filter-type-selectBox");
|
||||
elFilterTypeCheckboxes = document.getElementById("filter-type-checkboxes");
|
||||
elFilterTypeSelectBox = document.getElementById("filter-type-selectBox");
|
||||
elFilterTypeText = document.getElementById("filter-type-text");
|
||||
elFilterTypeCheckboxes = document.getElementById("filter-type-checkboxes");
|
||||
elFilterSearch = document.getElementById("filter-search");
|
||||
elFilterInView = document.getElementById("filter-in-view")
|
||||
elFilterRadius = document.getElementById("filter-radius");
|
||||
|
@ -132,6 +145,8 @@ function loaded() {
|
|||
elNoEntitiesInView = document.getElementById("no-entities-in-view");
|
||||
elNoEntitiesRadius = document.getElementById("no-entities-radius");
|
||||
|
||||
document.body.onclick = onBodyClick;
|
||||
|
||||
document.getElementById("entity-name").onclick = function() {
|
||||
setSortColumn('name');
|
||||
};
|
||||
|
@ -193,26 +208,30 @@ function loaded() {
|
|||
elFilterInView.onclick = toggleFilterInView;
|
||||
elFilterRadius.onchange = onRadiusChange;
|
||||
elInfoToggle.onclick = toggleInfo;
|
||||
|
||||
// create filter type dropdown checkboxes w/ label for each type
|
||||
elFilterTypeSelectBox.onclick = toggleTypeDropdown;
|
||||
for (let i = 0; i < FILTER_TYPES.length; ++i) {
|
||||
let type = FILTER_TYPES[i];
|
||||
let typeFilterID = "filter-type-" + type;
|
||||
let elDiv = document.createElement('div');
|
||||
let elLabel = document.createElement('label');
|
||||
elLabel.setAttribute("for", typeFilterID);
|
||||
elLabel.innerText = type;
|
||||
let elInput = document.createElement('input');
|
||||
elInput.setAttribute("type", "checkbox");
|
||||
elInput.setAttribute("id", typeFilterID);
|
||||
elInput.checked = true; // all types are checked initially
|
||||
toggleTypeFilter(type, false); // add all types to the initial type filter
|
||||
elInput.onclick = onToggleTypeFilter(type);
|
||||
elDiv.appendChild(elInput);
|
||||
elDiv.appendChild(elLabel);
|
||||
elFilterTypeCheckboxes.appendChild(elDiv);
|
||||
}
|
||||
|
||||
// create filter type dropdown checkboxes w/ label for each type
|
||||
elFilterTypeSelectBox.onclick = toggleTypeDropdown;
|
||||
for (let i = 0; i < FILTER_TYPES.length; ++i) {
|
||||
let type = FILTER_TYPES[i];
|
||||
let typeFilterID = "filter-type-" + type;
|
||||
let elDiv = document.createElement('div');
|
||||
let elLabel = document.createElement('label');
|
||||
elLabel.setAttribute("for", typeFilterID);
|
||||
elLabel.innerText = type;
|
||||
let elSpan = document.createElement('span');
|
||||
elSpan.setAttribute("class", "typeIcon");
|
||||
elSpan.innerHTML = ICON_FOR_TYPE[type];
|
||||
let elInput = document.createElement('input');
|
||||
elInput.setAttribute("type", "checkbox");
|
||||
elInput.setAttribute("id", typeFilterID);
|
||||
elInput.checked = true; // all types are checked initially
|
||||
toggleTypeFilter(type, false); // add all types to the initial type filter
|
||||
elInput.onclick = onToggleTypeFilter(type);
|
||||
elDiv.appendChild(elInput);
|
||||
elLabel.insertBefore(elSpan, elLabel.childNodes[0]);
|
||||
elDiv.appendChild(elLabel);
|
||||
elFilterTypeCheckboxes.appendChild(elDiv);
|
||||
}
|
||||
|
||||
elNoEntitiesInView.style.display = "none";
|
||||
|
||||
|
@ -336,16 +355,16 @@ function loaded() {
|
|||
function refreshEntityList() {
|
||||
PROFILE("refresh-entity-list", function() {
|
||||
PROFILE("filter", function() {
|
||||
let searchTerm = elFilterSearch.value.toLowerCase();
|
||||
visibleEntities = entities.filter(function(e) {
|
||||
let type = e.type === "Box" || e.type === "Sphere" ? "Shape" : e.type;
|
||||
let typeFilter = typeFilters.indexOf(type) > -1;
|
||||
let searchFilter = searchTerm === '' || (e.name.toLowerCase().indexOf(searchTerm) > -1 ||
|
||||
e.type.toLowerCase().indexOf(searchTerm) > -1 ||
|
||||
e.fullUrl.toLowerCase().indexOf(searchTerm) > -1 ||
|
||||
e.id.toLowerCase().indexOf(searchTerm) > -1);
|
||||
return typeFilter && searchFilter;
|
||||
});
|
||||
let searchTerm = elFilterSearch.value.toLowerCase();
|
||||
visibleEntities = entities.filter(function(e) {
|
||||
let type = e.type === "Box" || e.type === "Sphere" ? "Shape" : e.type;
|
||||
let typeFilter = typeFilters.indexOf(type) > -1;
|
||||
let searchFilter = searchTerm === '' || (e.name.toLowerCase().indexOf(searchTerm) > -1 ||
|
||||
e.type.toLowerCase().indexOf(searchTerm) > -1 ||
|
||||
e.fullUrl.toLowerCase().indexOf(searchTerm) > -1 ||
|
||||
e.id.toLowerCase().indexOf(searchTerm) > -1);
|
||||
return typeFilter && searchFilter;
|
||||
});
|
||||
});
|
||||
|
||||
PROFILE("sort", function() {
|
||||
|
@ -644,29 +663,38 @@ function loaded() {
|
|||
EventBridge.emitWebEvent(JSON.stringify({ type: 'radius', radius: elFilterRadius.value }));
|
||||
refreshEntities();
|
||||
}
|
||||
|
||||
function toggleTypeDropdown() {
|
||||
elFilterTypeCheckboxes.style.display = elFilterTypeCheckboxes.style.display === "block" ? "none" : "block";
|
||||
}
|
||||
|
||||
function toggleTypeFilter(type, refresh) {
|
||||
let typeFilterIndex = typeFilters.indexOf(type);
|
||||
if (typeFilterIndex > -1) {
|
||||
typeFilters.splice(typeFilterIndex, 1);
|
||||
} else {
|
||||
typeFilters.push(type);
|
||||
}
|
||||
if (refresh) {
|
||||
refreshEntityList();
|
||||
}
|
||||
}
|
||||
|
||||
function onToggleTypeFilter(type) {
|
||||
return function() {
|
||||
toggleTypeFilter(type, true);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function toggleTypeDropdown() {
|
||||
elFilterTypeCheckboxes.style.display = elFilterTypeCheckboxes.style.display === "block" ? "none" : "block";
|
||||
}
|
||||
|
||||
function toggleTypeFilter(type, refresh) {
|
||||
let typeFilterIndex = typeFilters.indexOf(type);
|
||||
if (typeFilterIndex > -1) {
|
||||
typeFilters.splice(typeFilterIndex, 1);
|
||||
} else {
|
||||
typeFilters.push(type);
|
||||
}
|
||||
|
||||
if (typeFilters.length === 0) {
|
||||
elFilterTypeText.innerText = "No Types";
|
||||
} else if (typeFilters.length === FILTER_TYPES.length) {
|
||||
elFilterTypeText.innerText = "All Types";
|
||||
} else {
|
||||
elFilterTypeText.innerText = "Types...";
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
refreshEntityList();
|
||||
}
|
||||
}
|
||||
|
||||
function onToggleTypeFilter(type) {
|
||||
return function() {
|
||||
toggleTypeFilter(type, true);
|
||||
};
|
||||
}
|
||||
|
||||
function toggleInfo(event) {
|
||||
showExtraInfo = !showExtraInfo;
|
||||
if (showExtraInfo) {
|
||||
|
@ -679,7 +707,15 @@ function loaded() {
|
|||
entityList.resize();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
|
||||
function onBodyClick(event) {
|
||||
let targetNode = event.target;
|
||||
if (!elFilterTypeSelectBox.contains(targetNode) && !elFilterTypeCheckboxes.contains(targetNode) &&
|
||||
elFilterTypeCheckboxes.style.display === "block") {
|
||||
toggleTypeDropdown();
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("keydown", function (keyDownEvent) {
|
||||
if (keyDownEvent.target.nodeName === "INPUT") {
|
||||
return;
|
||||
|
@ -731,7 +767,7 @@ function loaded() {
|
|||
refreshSortOrder();
|
||||
refreshEntities();
|
||||
});
|
||||
|
||||
|
||||
|
||||
augmentSpinButtons();
|
||||
|
||||
|
|
Loading…
Reference in a new issue