Fixed static graph without images creation and update previsualization

Former-commit-id: a3a0a7942f624d9ecb2a272560a57947be4b39a1
This commit is contained in:
fermin831 2018-12-11 13:56:48 +01:00
parent 67fb5fa152
commit e3243883f0
1 changed files with 7 additions and 3 deletions

View File

@ -3674,9 +3674,10 @@ function insertDB(type, values) {
success: function (data) {
if (data['correct']) {
id = data['id_data'];
if((type === 'group_item') || (type === 'icon') || (type === 'static_graph')){
values['naturalWidth'] = $('#preview > img')[0].naturalWidth;
values['naturalHeight'] = $('#preview > img')[0].naturalHeight;
var image_to_show = $('#preview > img')[0];
if((type === 'group_item') || (type === 'icon') || (type === 'static_graph' && typeof(image_to_show) !== 'undefined')){
values['naturalWidth'] = image_to_show.naturalWidth;
values['naturalHeight'] = image_to_show.naturalHeight;
}
createItem(type, values, id);
addItemSelectParents(id, data['text']);
@ -4947,6 +4948,9 @@ function showPreviewStaticGraph(staticGraph) {
$spinner.prop("src", "../../images/spinner.gif");
}
// If no image configured do not show anything
if (staticGraph === null) return;
$("#preview")
.empty()
.css('text-align', 'right')