Changing default color.
This commit is contained in:
parent
303a2d182c
commit
f6f5a4c00d
@ -12,28 +12,21 @@ OV.SettingsSidebarPanel = class extends OV.SidebarPanel
|
||||
|
||||
InitSettings (settings)
|
||||
{
|
||||
let table = $('<div>').addClass ('ov_property_table').appendTo (this.contentDiv);
|
||||
|
||||
let backgroundColorParams = settings.backgroundColor;
|
||||
this.AddColorInput (table, backgroundColorParams, function (newVal) {
|
||||
backgroundColorParams.onChange (newVal);
|
||||
});
|
||||
|
||||
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.');
|
||||
}
|
||||
|
||||
AddColorInput (table, params, onChange)
|
||||
AddColorParameters (params, title, description)
|
||||
{
|
||||
let row = $('<div>').addClass ('ov_property_table_row').appendTo (table);
|
||||
let nameColum = $('<div>').addClass ('ov_property_table_cell ov_property_table_name').appendTo (row);
|
||||
let valueColumn = $('<div>').addClass ('ov_property_table_cell ov_property_table_value').appendTo (row);
|
||||
nameColum.html (params.name + ':').attr ('title', params.name);
|
||||
|
||||
let colorInput = $('<input>').attr ('type', 'color').addClass ('ov_sidebar_color').appendTo (valueColumn);
|
||||
$('<div>').addClass ('ov_sidebar_subtitle').html (title).appendTo (this.contentDiv);
|
||||
let contentDiv = $('<div>').addClass ('ov_sidebar_settings_content').appendTo (this.contentDiv);
|
||||
let colorColumn = $('<div>').addClass ('ov_sidebar_small_column').appendTo (contentDiv);
|
||||
$('<div>').addClass ('ov_sidebar_column').html (description).appendTo (contentDiv);
|
||||
let colorInput = $('<input>').attr ('type', 'color').addClass ('ov_sidebar_color').appendTo (colorColumn);
|
||||
colorInput.val ('#' + OV.ColorToHexString (params.defaultValue));
|
||||
|
||||
colorInput.change (function () {
|
||||
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;
|
||||
}
|
||||
|
||||
div.ov_sidebar_subtitle
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
div.ov_sidebar_content
|
||||
{
|
||||
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
|
||||
{
|
||||
width: 64px;
|
||||
width: 30px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
|
||||
@ -450,13 +450,20 @@ OV.Website = class
|
||||
|
||||
settingsPanel.InitSettings ({
|
||||
backgroundColor : {
|
||||
name : 'Background Color',
|
||||
defaultValue : this.viewerSettings.backgroundColor,
|
||||
onChange : function (newVal) {
|
||||
obj.viewerSettings.backgroundColor = newVal;
|
||||
obj.viewer.SetBackgroundColor (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