Vendorices cdb

pull/464/head
Javier Arce 10 years ago
parent d011521d03
commit 4bbade307a

@ -1,6 +1,6 @@
// cartodb.js version: 3.9.02
// cartodb.js version: 3.9.05-dev
// uncompressed version: cartodb.uncompressed.js
// sha: 4994a24e6b8716ad58816f4917f154f659977abd
// sha: 3fb08ead2af6c976d8a2d9fbdb4708aab1e9ef00
(function() {
var root = this;
@ -20686,7 +20686,7 @@ this.LZMA = LZMA;
var cdb = root.cdb = {};
cdb.VERSION = '3.9.02';
cdb.VERSION = '3.9.05-dev';
cdb.DEBUG = false;
cdb.CARTOCSS_VERSIONS = {
@ -25547,14 +25547,17 @@ cdb.geo.ui.InfoBox = cdb.core.View.extend({
cdb.geo.ui.Tooltip = cdb.geo.ui.InfoBox.extend({
DEFAULT_OFFSET_TOP: 10,
defaultTemplate: '<p>{{text}}</p>',
className: 'cartodb-tooltip',
defaults: {
vertical_offset: 0,
horizontal_offset: 0,
position: 'top|center'
},
initialize: function() {
this.options.template = this.options.template || this.defaultTemplate;
this.options.position = 'none';
this.options.width = null;
cdb.geo.ui.InfoBox.prototype.initialize.call(this);
this._filter = null;
this.showing = false;
@ -25640,13 +25643,45 @@ cdb.geo.ui.Tooltip = cdb.geo.ui.InfoBox.extend({
}
this.render(data);
this.elder('show', pos, data);
this.$el.css({
'left': pos.x,
'top': pos.y + (this.options.offset_top || this.DEFAULT_OFFSET_TOP)
});
this.setPosition(pos);
return this;
},
setPosition: function(point) {
var props = {
left: 0,
top: 0
};
var pos = this.options.position;
var $el = this.$el;
var h = $el.innerHeight();
var w = $el.innerWidth();
// Vertically
if (pos.indexOf('top') !== -1) {
props.top = -h;
} else if (pos.indexOf('middle') !== -1) {
props.top = -(h/2);
}
// Horizontally
if(pos.indexOf('left') !== -1) {
props.left = -w;
} else if(pos.indexOf('center') !== -1) {
props.left = -(w/2);
}
// Offsets
props.top += this.options.vertical_offset;
props.left += this.options.horizontal_offset;
$el.css({
top: (point.y + props.top),
left: (point.x + props.left)
});
},
render: function(data) {
this.$el.html( this.template(data) );
@ -31161,6 +31196,9 @@ var Vis = cdb.core.View.extend({
},
addTooltip: function(layerView) {
if(!layerView || !layerView.containTooltip || !layerView.containTooltip()) {
return;
}
for(var i = 0; i < layerView.getLayerCount(); ++i) {
var t = layerView.getTooltipData(i);
if (t) {
@ -31168,6 +31206,9 @@ var Vis = cdb.core.View.extend({
var tooltip = new cdb.geo.ui.Tooltip({
layer: layerView,
template: t.template,
position: 'bottom|right',
vertical_offset: 10,
horizontal_offset: 4,
fields: t.fields,
omit_columns: ['cartodb_id']
});
@ -32130,7 +32171,8 @@ Layers.register('torque', function(vis, data) {
infowindow: true,
https: false,
legends: true,
time_slider: true
time_slider: true,
tooltip: true
});
// check map type
@ -32170,6 +32212,9 @@ Layers.register('torque', function(vis, data) {
if(options.infowindow) {
viz.addInfowindow(layerView);
}
if(options.tooltip) {
viz.addTooltip(layerView);
}
if(options.legends) {
viz.addLegends([layerData]);
}

Loading…
Cancel
Save