Codes minor adjustments

Codes minor adjustments.
Some formatting issues.
Use element instead of a string
This commit is contained in:
Alezia Kurdis 2020-03-04 18:42:57 -05:00 committed by GitHub
parent 206b1b12c5
commit d934018c7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,7 +33,7 @@ const PROPERTY_SELECTION_VISIBILITY = Object.freeze({
SINGLE_SELECTION: 1, SINGLE_SELECTION: 1,
MULTIPLE_SELECTIONS: 2, MULTIPLE_SELECTIONS: 2,
MULTI_DIFF_SELECTIONS: 4, MULTI_DIFF_SELECTIONS: 4,
ANY_SELECTIONS: 7, /* SINGLE_SELECTION | MULTIPLE_SELECTIONS | MULTI_DIFF_SELECTIONS */ ANY_SELECTIONS: 7 /* SINGLE_SELECTION | MULTIPLE_SELECTIONS | MULTI_DIFF_SELECTIONS */
}); });
// Multiple-selection behavior // Multiple-selection behavior
@ -43,7 +43,7 @@ const PROPERTY_MULTI_DISPLAY_MODE = Object.freeze({
* Comma separated values * Comma separated values
* Limited for properties with type "string" or "textarea" and readOnly enabled * Limited for properties with type "string" or "textarea" and readOnly enabled
*/ */
COMMA_SEPARATED_VALUES: 1, COMMA_SEPARATED_VALUES: 1
}); });
const GROUPS = [ const GROUPS = [
@ -915,7 +915,6 @@ const GROUPS = [
{ {
id: "particles_emit", id: "particles_emit",
label: "PARTICLES EMIT", label: "PARTICLES EMIT",
//isMinor: true,
properties: [ properties: [
{ {
label: "Emit Rate", label: "Emit Rate",
@ -988,7 +987,6 @@ const GROUPS = [
{ {
id: "particles_size", id: "particles_size",
label: "PARTICLES SIZE", label: "PARTICLES SIZE",
//isMinor: true,
properties: [ properties: [
{ {
type: "triple", type: "triple",
@ -1032,7 +1030,6 @@ const GROUPS = [
{ {
id: "particles_color", id: "particles_color",
label: "PARTICLES COLOR", label: "PARTICLES COLOR",
//isMinor: true,
properties: [ properties: [
{ {
type: "triple", type: "triple",
@ -1106,7 +1103,6 @@ const GROUPS = [
{ {
id: "particles_behavior", id: "particles_behavior",
label: "PARTICLES BEHAVIOR", label: "PARTICLES BEHAVIOR",
//isMinor: true,
properties: [ properties: [
{ {
label: "Emit Acceleration", label: "Emit Acceleration",
@ -1181,7 +1177,6 @@ const GROUPS = [
{ {
id: "particles_constraints", id: "particles_constraints",
label: "PARTICLES CONSTRAINTS", label: "PARTICLES CONSTRAINTS",
//isMinor: true,
properties: [ properties: [
{ {
type: "triple", type: "triple",
@ -1408,7 +1403,6 @@ const GROUPS = [
} }
] ]
}, },
,
{ {
id: "scripts", id: "scripts",
label: "SCRIPTS", label: "SCRIPTS",
@ -4008,8 +4002,8 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
function loaded() { function loaded() {
openEventBridge(function() { openEventBridge(function() {
let elPropertiesList = document.getElementById("properties-pages"); let elPropertiesList = document.getElementById("properties-pages");
let tabs = ""; let elTabs = document.getElementById("tabs");
GROUPS.forEach(function(group) { GROUPS.forEach(function(group) {
let elGroup; let elGroup;
@ -4023,8 +4017,7 @@ function loaded() {
elLegend.className = "tab-section-header"; elLegend.className = "tab-section-header";
elLegend.appendChild(createElementFromHTML(`<div class="labelTabHeader">${group.label}</div>`)); elLegend.appendChild(createElementFromHTML(`<div class="labelTabHeader">${group.label}</div>`));
elGroup.appendChild(elLegend); elGroup.appendChild(elLegend);
tabs = tabs +'<button id="tab-'+ group.id +'" onclick="showPage(' + "'" + group.id + "'" + ');"><img src="tabs/'+ group.id +'.png"></button>'; elTabs.appendChild(createElementFromHTML('<button id="tab-'+ group.id +'" onclick="showPage(' + "'" + group.id + "'" + ');"><img src="tabs/'+ group.id +'.png"></button>'));
//tabs = tabs +'<button id="tab-'+ group.id +'" title="' + group.label + '" onclick="showPage(' + "'" + group.id + "'" + ');"><img src="tabs/'+ group.id +'.png"></button>';
} }
group.properties.forEach(function(propertyData) { group.properties.forEach(function(propertyData) {
@ -4294,23 +4287,6 @@ function loaded() {
elDiv.insertBefore(elStaticMaterialData, elMaterialData); elDiv.insertBefore(elStaticMaterialData, elMaterialData);
elDiv.insertBefore(elMaterialDataEditor, elMaterialData); elDiv.insertBefore(elMaterialDataEditor, elMaterialData);
elDiv.insertBefore(elMaterialDataEditorStatus, elMaterialData); elDiv.insertBefore(elMaterialDataEditorStatus, elMaterialData);
/*
// Collapsible sections
let elCollapsible = document.getElementsByClassName("collapse-icon");
let toggleCollapsedEvent = function(event) {
let element = this.parentNode.parentNode;
let isCollapsed = element.dataset.collapsed !== "true";
element.dataset.collapsed = isCollapsed ? "true" : false;
element.setAttribute("collapsed", isCollapsed ? "true" : "false");
this.textContent = isCollapsed ? "L" : "M";
};
for (let collapseIndex = 0, numCollapsibles = elCollapsible.length; collapseIndex < numCollapsibles; ++collapseIndex) {
let curCollapsibleElement = elCollapsible[collapseIndex];
curCollapsibleElement.addEventListener("click", toggleCollapsedEvent, true);
}
*/
// Textarea scrollbars // Textarea scrollbars
let elTextareas = document.getElementsByTagName("TEXTAREA"); let elTextareas = document.getElementsByTagName("TEXTAREA");
@ -4466,8 +4442,6 @@ function loaded() {
}; };
} }
document.getElementById("tabs").innerHTML = tabs;
bindAllNonJSONEditorElements(); bindAllNonJSONEditorElements();
showGroupsForType("None"); showGroupsForType("None");
@ -4491,15 +4465,14 @@ function loaded() {
} }
function showOnTheSamePage(entityType) { function showOnTheSamePage(entityType) {
var i; let numberOfTypes = entityType.length;
var numbType = entityType.length; let matchingType = 0;
var matchingType = 0; for (let i = 0; i < numberOfTypes; i++) {
for (i = 0; i < numbType; i++) {
if (GROUPS_PER_TYPE[entityType[i]].includes(currentTab)) { if (GROUPS_PER_TYPE[entityType[i]].includes(currentTab)) {
matchingType = matchingType + 1; matchingType = matchingType + 1;
} }
} }
if (matchingType !== numbType) { if (matchingType !== numberOfTypes) {
currentTab = "base"; currentTab = "base";
} }
showPage(currentTab); showPage(currentTab);
@ -4516,4 +4489,4 @@ function showPage(id) {
document.getElementById("tab-" + groupKey).style.backgroundColor = "#404040"; document.getElementById("tab-" + groupKey).style.backgroundColor = "#404040";
} }
}); });
} }