Changing default color.
This commit is contained in:
parent
303a2d182c
commit
f6f5a4c00d
@ -12,28 +12,21 @@ OV.SettingsSidebarPanel = class extends OV.SidebarPanel
|
|||||||
|
|
||||||
InitSettings (settings)
|
InitSettings (settings)
|
||||||
{
|
{
|
||||||
let table = $('<div>').addClass ('ov_property_table').appendTo (this.contentDiv);
|
this.AddColorParameters (settings.backgroundColor, 'Background Color', 'Changing the background color affects only the visualization.');
|
||||||
|
this.AddColorParameters (settings.defaultColor, 'Default Color', 'Default color is used when no material was defined in the file.');
|
||||||
let backgroundColorParams = settings.backgroundColor;
|
|
||||||
this.AddColorInput (table, backgroundColorParams, function (newVal) {
|
|
||||||
backgroundColorParams.onChange (newVal);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AddColorInput (table, params, onChange)
|
AddColorParameters (params, title, description)
|
||||||
{
|
{
|
||||||
let row = $('<div>').addClass ('ov_property_table_row').appendTo (table);
|
$('<div>').addClass ('ov_sidebar_subtitle').html (title).appendTo (this.contentDiv);
|
||||||
let nameColum = $('<div>').addClass ('ov_property_table_cell ov_property_table_name').appendTo (row);
|
let contentDiv = $('<div>').addClass ('ov_sidebar_settings_content').appendTo (this.contentDiv);
|
||||||
let valueColumn = $('<div>').addClass ('ov_property_table_cell ov_property_table_value').appendTo (row);
|
let colorColumn = $('<div>').addClass ('ov_sidebar_small_column').appendTo (contentDiv);
|
||||||
nameColum.html (params.name + ':').attr ('title', params.name);
|
$('<div>').addClass ('ov_sidebar_column').html (description).appendTo (contentDiv);
|
||||||
|
let colorInput = $('<input>').attr ('type', 'color').addClass ('ov_sidebar_color').appendTo (colorColumn);
|
||||||
let colorInput = $('<input>').attr ('type', 'color').addClass ('ov_sidebar_color').appendTo (valueColumn);
|
|
||||||
colorInput.val ('#' + OV.ColorToHexString (params.defaultValue));
|
colorInput.val ('#' + OV.ColorToHexString (params.defaultValue));
|
||||||
|
|
||||||
colorInput.change (function () {
|
colorInput.change (function () {
|
||||||
let colorStr = colorInput.val ().substr (1);
|
let colorStr = colorInput.val ().substr (1);
|
||||||
onChange (OV.HexStringToColor (colorStr));
|
params.onChange (OV.HexStringToColor (colorStr));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -284,14 +284,37 @@ div.ov_sidebar_title img.ov_sidebar_title_img
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.ov_sidebar_subtitle
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
div.ov_sidebar_content
|
div.ov_sidebar_content
|
||||||
{
|
{
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.ov_sidebar_content div.ov_sidebar_settings_content
|
||||||
|
{
|
||||||
|
margin: 10px 0px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.ov_sidebar_content div.ov_sidebar_small_column
|
||||||
|
{
|
||||||
|
width: 50px;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.ov_sidebar_content div.ov_sidebar_column
|
||||||
|
{
|
||||||
|
width: 250px;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
div.ov_sidebar_content input.ov_sidebar_color
|
div.ov_sidebar_content input.ov_sidebar_color
|
||||||
{
|
{
|
||||||
width: 64px;
|
width: 30px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -450,13 +450,20 @@ OV.Website = class
|
|||||||
|
|
||||||
settingsPanel.InitSettings ({
|
settingsPanel.InitSettings ({
|
||||||
backgroundColor : {
|
backgroundColor : {
|
||||||
name : 'Background Color',
|
|
||||||
defaultValue : this.viewerSettings.backgroundColor,
|
defaultValue : this.viewerSettings.backgroundColor,
|
||||||
onChange : function (newVal) {
|
onChange : function (newVal) {
|
||||||
obj.viewerSettings.backgroundColor = newVal;
|
obj.viewerSettings.backgroundColor = newVal;
|
||||||
obj.viewer.SetBackgroundColor (newVal);
|
obj.viewer.SetBackgroundColor (newVal);
|
||||||
obj.cookieHandler.SetColorVal ('ov_background_color', newVal);
|
obj.cookieHandler.SetColorVal ('ov_background_color', newVal);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
defaultColor : {
|
||||||
|
defaultValue : this.importSettings.defaultColor,
|
||||||
|
onChange : function (newVal) {
|
||||||
|
obj.importSettings.defaultColor = newVal;
|
||||||
|
obj.cookieHandler.SetColorVal ('ov_default_color', newVal);
|
||||||
|
obj.ReloadFiles ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user