').addClass ('ov_sidebar_settings_description').appendTo (contentDiv);
+ OV.CreateSvgIcon (warningDiv, 'assets/images/sidebar/warning.svg', 'left_inline');
+ $('
').addClass ('ov_sidebar_settings_warning').html (warningText).appendTo (warningDiv);
+ }
+ return {
+ pickr : pickr,
+ warning : warningDiv
+ };
}
AddResetToDefaultsButton (defaultSettings, callbacks)
{
let resetToDefaultsButton = $('
').addClass ('ov_button').addClass ('outline').addClass ('ov_sidebar_button').html ('Reset to Default').appendTo (this.contentDiv);
resetToDefaultsButton.click (() => {
- this.backgroundColorInput.setColor ('#' + OV.ColorToHexString (defaultSettings.backgroundColor));
- this.defaultColorInput.setColor ('#' + OV.ColorToHexString (defaultSettings.defaultColor));
+ this.backgroundColorInput.pickr.setColor ('#' + OV.ColorToHexString (defaultSettings.backgroundColor));
+ this.defaultColorInput.pickr.setColor ('#' + OV.ColorToHexString (defaultSettings.defaultColor));
callbacks.onBackgroundColorChange (defaultSettings.backgroundColor);
callbacks.onDefaultColorChange (defaultSettings.defaultColor);
});
diff --git a/website/o3dv/js/sharingdialog.js b/website/o3dv/js/sharingdialog.js
index 2300136..a8123fd 100644
--- a/website/o3dv/js/sharingdialog.js
+++ b/website/o3dv/js/sharingdialog.js
@@ -79,19 +79,14 @@ OV.ShowSharingDialog = function (importer, settings, camera)
embeddingCodeParams.camera = checked ? camera : null;
embeddingCodeInput.val (GetEmbeddingCode (embeddingCodeParams));
});
- if (OV.FeatureSet.ColorSettings) {
- AddCheckboxLine (optionsSection, 'Use overridden background color', 'embed_background', (checked) => {
- embeddingCodeParams.backgroundColor = checked ? settings.backgroundColor : null;
- embeddingCodeInput.val (GetEmbeddingCode (embeddingCodeParams));
- });
- AddCheckboxLine (optionsSection, 'Use overridden default color', 'embed_color', (checked) => {
- embeddingCodeParams.defaultColor = checked ? settings.defaultColor : null;
- embeddingCodeInput.val (GetEmbeddingCode (embeddingCodeParams));
- });
- } else {
- embeddingCodeParams.backgroundColor = null;
- embeddingCodeParams.defaultColor = null;
- }
+ AddCheckboxLine (optionsSection, 'Use overridden background color', 'embed_background', (checked) => {
+ embeddingCodeParams.backgroundColor = checked ? settings.backgroundColor : null;
+ embeddingCodeInput.val (GetEmbeddingCode (embeddingCodeParams));
+ });
+ AddCheckboxLine (optionsSection, 'Use overridden default color', 'embed_color', (checked) => {
+ embeddingCodeParams.defaultColor = checked ? settings.defaultColor : null;
+ embeddingCodeInput.val (GetEmbeddingCode (embeddingCodeParams));
+ });
embeddingCodeInput.val (GetEmbeddingCode (embeddingCodeParams));
}
diff --git a/website/o3dv/js/website.js b/website/o3dv/js/website.js
index e7c6dff..1f46af5 100644
--- a/website/o3dv/js/website.js
+++ b/website/o3dv/js/website.js
@@ -38,6 +38,7 @@ OV.Website = class
side : THREE.DoubleSide
});
this.detailsPanel = null;
+ this.settingsPanel = null;
this.model = null;
this.dialog = null;
}
@@ -133,6 +134,7 @@ OV.Website = class
this.viewer.AddMeshes (threeMeshes);
this.viewer.SetUpVector (importResult.upVector, false);
this.navigator.FillTree (importResult);
+ this.settingsPanel.Update (this.model);
this.FitModelToWindow (true);
}
@@ -520,10 +522,7 @@ OV.Website = class
}
this.detailsPanel = new OV.DetailsSidebarPanel (this.parameters.sidebarDiv);
- let settingsPanel = null;
- if (OV.FeatureSet.ColorSettings) {
- settingsPanel = new OV.SettingsSidebarPanel (this.parameters.sidebarDiv);
- }
+ this.settingsPanel = new OV.SettingsSidebarPanel (this.parameters.sidebarDiv);
let sidebarPanels = [
{
@@ -532,17 +531,15 @@ OV.Website = class
image : 'details',
title : 'Details panel',
button : null
- }
- ];
- if (OV.FeatureSet.ColorSettings) {
- sidebarPanels.push ({
+ },
+ {
panelId : null,
- panel : settingsPanel,
+ panel : this.settingsPanel,
image : 'settings',
title : 'Settings panel',
button : null
- });
- }
+ }
+ ];
for (let id = 0; id < sidebarPanels.length; id++) {
let sidebarPanel = sidebarPanels[id];
@@ -559,29 +556,27 @@ OV.Website = class
});
}
- if (OV.FeatureSet.ColorSettings) {
- let defaultSettings = new OV.WebsiteSettings ();
- settingsPanel.InitSettings (
- this.settings,
- defaultSettings,
- {
- onBackgroundColorChange : (newVal) => {
- this.settings.backgroundColor = newVal;
- this.settings.SaveToCookies (this.cookieHandler);
- this.viewer.SetBackgroundColor (newVal);
- },
- onDefaultColorChange : (newVal) => {
- this.settings.defaultColor = newVal;
- this.settings.SaveToCookies (this.cookieHandler);
- if (this.modelLoader.defaultMaterial !== null) {
- OV.ReplaceDefaultMaterialColor (this.model, newVal);
- this.modelLoader.ReplaceDefaultMaterialColor (newVal);
- }
- this.viewer.Render ();
+ let defaultSettings = new OV.WebsiteSettings ();
+ this.settingsPanel.InitSettings (
+ this.settings,
+ defaultSettings,
+ {
+ onBackgroundColorChange : (newVal) => {
+ this.settings.backgroundColor = newVal;
+ this.settings.SaveToCookies (this.cookieHandler);
+ this.viewer.SetBackgroundColor (newVal);
+ },
+ onDefaultColorChange : (newVal) => {
+ this.settings.defaultColor = newVal;
+ this.settings.SaveToCookies (this.cookieHandler);
+ if (this.modelLoader.defaultMaterial !== null) {
+ OV.ReplaceDefaultMaterialColor (this.model, newVal);
+ this.modelLoader.ReplaceDefaultMaterialColor (newVal);
}
+ this.viewer.Render ();
}
- );
- }
+ }
+ );
let show = this.cookieHandler.GetBoolVal ('ov_show_sidebar', true);
ShowSidebar (this.sidebar, this.cookieHandler, sidebarPanels, show ? sidebarPanels[0].panelId : null);