Disable color settings with feature toggle.
This commit is contained in:
parent
fe2836d632
commit
78aaba8a32
@ -1,4 +1,4 @@
|
||||
OV.FeatureSet =
|
||||
{
|
||||
|
||||
ColorSettings : false
|
||||
};
|
||||
|
||||
@ -23,8 +23,8 @@ OV.ShowSharingDialog = function (importer, settings, camera)
|
||||
let builder = OV.CreateUrlBuilder ();
|
||||
builder.AddModelUrls (params.files);
|
||||
builder.AddCamera (params.camera);
|
||||
builder.AddBackground (params.background);
|
||||
builder.AddColor (params.color);
|
||||
builder.AddBackground (params.backgroundColor);
|
||||
builder.AddColor (params.defaultColor);
|
||||
let hashParameters = builder.GetParameterList ();
|
||||
|
||||
let embeddingCode = '';
|
||||
@ -79,14 +79,19 @@ OV.ShowSharingDialog = function (importer, settings, camera)
|
||||
embeddingCodeParams.camera = checked ? camera : null;
|
||||
embeddingCodeInput.val (GetEmbeddingCode (embeddingCodeParams));
|
||||
});
|
||||
AddCheckboxLine (optionsSection, 'Use overridden background color', 'embed_background', (checked) => {
|
||||
embeddingCodeParams.background = checked ? settings.backgroundColor : null;
|
||||
embeddingCodeInput.val (GetEmbeddingCode (embeddingCodeParams));
|
||||
});
|
||||
AddCheckboxLine (optionsSection, 'Use overridden default color', 'embed_color', (checked) => {
|
||||
embeddingCodeParams.color = checked ? settings.defaultColor : 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;
|
||||
}
|
||||
embeddingCodeInput.val (GetEmbeddingCode (embeddingCodeParams));
|
||||
}
|
||||
|
||||
@ -112,8 +117,8 @@ OV.ShowSharingDialog = function (importer, settings, camera)
|
||||
let embeddingCodeParams = {
|
||||
files : modelFiles,
|
||||
camera : camera,
|
||||
background : settings.backgroundColor,
|
||||
color : settings.defaultColor
|
||||
backgroundColor : settings.backgroundColor,
|
||||
defaultColor : settings.defaultColor
|
||||
};
|
||||
|
||||
let dialog = new OV.ButtonDialog ();
|
||||
|
||||
@ -520,7 +520,10 @@ OV.Website = class
|
||||
}
|
||||
|
||||
this.detailsPanel = new OV.DetailsSidebarPanel (this.parameters.sidebarDiv);
|
||||
let settingsPanel = new OV.SettingsSidebarPanel (this.parameters.sidebarDiv);
|
||||
let settingsPanel = null;
|
||||
if (OV.FeatureSet.ColorSettings) {
|
||||
settingsPanel = new OV.SettingsSidebarPanel (this.parameters.sidebarDiv);
|
||||
}
|
||||
|
||||
let sidebarPanels = [
|
||||
{
|
||||
@ -529,15 +532,17 @@ OV.Website = class
|
||||
image : 'details',
|
||||
title : 'Details panel',
|
||||
button : null
|
||||
},
|
||||
{
|
||||
}
|
||||
];
|
||||
if (OV.FeatureSet.ColorSettings) {
|
||||
sidebarPanels.push ({
|
||||
panelId : null,
|
||||
panel : settingsPanel,
|
||||
image : 'settings',
|
||||
title : 'Settings panel',
|
||||
button : null
|
||||
}
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
for (let id = 0; id < sidebarPanels.length; id++) {
|
||||
let sidebarPanel = sidebarPanels[id];
|
||||
@ -554,27 +559,29 @@ OV.Website = class
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
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 ();
|
||||
}
|
||||
this.viewer.Render ();
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
let show = this.cookieHandler.GetBoolVal ('ov_show_sidebar', true);
|
||||
ShowSidebar (this.sidebar, this.cookieHandler, sidebarPanels, show ? sidebarPanels[0].panelId : null);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user