/usr/share/games/flightgear/Phi/map/FollowControl.js is in flightgear-phi 2016.4.2+dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | L.FollowControl = L.Control.extend({
options: {
getPosition: function() { return L.latLng(53.5,10); },
element: 'div',
cssClass: '',
innerHTML: '',
initialFollow: true,
followUpdateInterval: 100,
noFollowUpdateInterval: 1000,
},
initialize: function(options) {
L.Control.prototype.initialize.call(this,options);
L.Util.setOptions(this,options);
},
onAdd: function(map) {
this._map = map;
this._div = L.DomUtil.create(this.options.element, this.options.cssClass );
this._div.innerHTML = this.options.innerHTML;
this._doFollow = this.options.initialFollow;
var that = this;
this._div.onclick = function() {
that.setFollow(true);
return true;
};
this.update();
return this._div;
},
onRemove: function(map) {
this._map = null;
},
setFollow: function( v ) {
this._doFollow = v;
},
update: function() {
if( this._map && this._doFollow ) {
this._map.setView( this.options.getPosition() );
var that = this;
setTimeout( function() { that.update(); }, this.options.noFollowUpdateInterval );
} else {
var that = this;
setTimeout( function() { that.update(); }, this.options.followUpdateInterval );
}
},
_map: null,
_doFollow: true,
});
L.followControl = function( options ) {
return new L.FollowControl( options );
}
|