Debian Codegraph @

dojox/geo/charting/_Marker.js

raw symbols SCIP
1 define([
2 "dojo/_base/lang",
3 "dojo/_base/array",
4 "dojo/_base/declare",
5 "dojo/_base/sniff",
6 "./_base"
7 ], function(lang, arr, declare, has){
8 return declare("dojox.geo.charting._Marker", null, {
9
10 _needTooltipRefresh: null,
11 _map: null,
12
13 constructor: function(markerData, map){
14 this._map = map;
15 var mapObj = map.mapObj;
16 this.features = mapObj.features;
17 this.markerData = markerData;
18 _needTooltipRefresh = false;
19 },
20
21 show: function(featureId, evt){
22 this.currentFeature = this.features[featureId];
23 if(this._map.showTooltips && this.currentFeature){
24 this.markerText = this.currentFeature.markerText || this.markerData[featureId] || featureId;
25 dojox.geo.charting.showTooltip(this.markerText, this.currentFeature.shape, ["before"]);
26 }
27 this._needTooltipRefresh = false;
28 },
29
30 hide: function(){
31 if(this._map.showTooltips && this.currentFeature){
32 dojox.geo.charting.hideTooltip(this.currentFeature.shape);
33 }
34 this._needTooltipRefresh = false;
35 },
36
37 _getGroupBoundingBox: function(group){
38 var shapes = group.children;
39 var feature = shapes[0];
40 var bbox = feature.getBoundingBox();
41 this._arround = lang.clone(bbox);
42 arr.forEach(shapes, function(item){
43 var _bbox = item.getBoundingBox();
44 this._arround.x = Math.min(this._arround.x, _bbox.x);
45 this._arround.y = Math.min(this._arround.y, _bbox.y);
46 },this);
47 },
48
49 _toWindowCoords: function(arround, coords, containerSize){
50 var toLeft = (arround.x - this.topLeft[0]) * this.scale;
51 var toTop = (arround.y - this.topLeft[1]) * this.scale
52 if(has("ff") == 3.5){
53 arround.x = coords.x;
54 arround.y = coords.y;
55 }else if(has("chrome")){
56 arround.x = containerSize.x + toLeft;
57 arround.y = containerSize.y + toTop;
58 }else{
59 arround.x = coords.x + toLeft;
60 arround.y = coords.y + toTop;
61 }
62 arround.width = (this.currentFeature._bbox[2]) * this.scale;
63 arround.height = (this.currentFeature._bbox[3]) * this.scale;
64 arround.x += arround.width / 6;
65 arround.y += arround.height / 4;
66 }
67 });
68 });