Merge branch '90-static-graph-se-redimensionan-en-consolas-visuales' into 'develop'

Creator and updater palette respect original size for elements with lower than 150 size - #90

See merge request !235
This commit is contained in:
Enrique Camargo 2017-03-07 17:41:14 +01:00
commit 0a8dee6d4b

View File

@ -244,17 +244,23 @@ function update_button_palette_callback() {
} }
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
if ((values['width'] == 0) || (values['height'] == 0)) { if ((values['width'] == 0) || (values['height'] == 0)) {
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', 70); $("#image_" + idItem).attr('width', 70);
$("#image_" + idItem).attr('height', 70); $("#image_" + idItem).attr('height', 70);
$("#image_" + idItem).css('width', '70px'); $("#image_" + idItem).css('width', '70px');
$("#image_" + idItem).css('height', '70px'); $("#image_" + idItem).css('height', '70px');
}
else{
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
}
} }
else { else {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -264,9 +270,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', values['width'] + 'px'); $("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px'); $("#image_" + idItem).css('height', values['height'] + 'px');
} }
break; break;
case 'percentile_bar': case 'percentile_bar':
case 'percentile_item': case 'percentile_item':
@ -333,18 +336,24 @@ function update_button_palette_callback() {
alert('Undefined height'); alert('Undefined height');
return false; return false;
} }
$("#image_" + idItem).attr('src', "images/spinner.gif"); $("#image_" + idItem).attr('src', "images/spinner.gif");
if ((values['width'] == 0) || (values['height'] == 0)) { if ((values['width'] == 0) || (values['height'] == 0)) {
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', 70); $("#image_" + idItem).attr('width', 70);
$("#image_" + idItem).attr('height', 70); $("#image_" + idItem).attr('height', 70);
$("#image_" + idItem).css('width', '70px'); $("#image_" + idItem).css('width', '70px');
$("#image_" + idItem).css('height', '70px'); $("#image_" + idItem).css('height', '70px');
}
else{
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
}
} }
else { else {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -1959,9 +1968,11 @@ function createItem(type, values, id_data) {
if ((values['width'] == 0) || (values['height'] == 0)) { if ((values['width'] == 0) || (values['height'] == 0)) {
// Do none // Do none
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$image.attr('width', '70') $image.attr('width', '70')
.attr('height', '70'); .attr('height', '70');
} }
}
else { else {
$image.attr('width', values['width']) $image.attr('width', values['width'])
.attr('height', values['height']); .attr('height', values['height']);
@ -2159,9 +2170,11 @@ function createItem(type, values, id_data) {
break; break;
case 'icon': case 'icon':
if ((values['width'] == 0) || (values['height'] == 0)) { if ((values['width'] == 0) || (values['height'] == 0)) {
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
sizeStyle = 'width: ' + '70' + 'px; height: ' + '70' + 'px;'; sizeStyle = 'width: ' + '70' + 'px; height: ' + '70' + 'px;';
imageSize = 'width="' + '70' + '" height="' + '70' + '"'; imageSize = 'width="' + '70' + '" height="' + '70' + '"';
} }
}
else { else {
sizeStyle = 'width: ' + values['width'] + 'px; height: ' + values['height'] + 'px;'; sizeStyle = 'width: ' + values['width'] + 'px; height: ' + values['height'] + 'px;';
imageSize = 'width="' + values['width'] + '" height="' + values['height'] + '"'; imageSize = 'width="' + values['width'] + '" height="' + values['height'] + '"';
@ -2177,9 +2190,7 @@ function createItem(type, values, id_data) {
default: default:
//Maybe create in any Enterprise item. //Maybe create in any Enterprise item.
if (typeof(enterprise_createItem) == 'function') { if (typeof(enterprise_createItem) == 'function') {
if (values['image'] == "") {
values['image'] = 'visualmap.services'; values['image'] = 'visualmap.services';
}
temp_item = enterprise_createItem(type, values, id_data); temp_item = enterprise_createItem(type, values, id_data);
if (temp_item != false) { if (temp_item != false) {
item = temp_item; item = temp_item;