Adjust European short trip heuristic from >3 days to >1 day to correctly detect when user has returned home from European trips. This fixes the April 29-30, 2023 case where the location incorrectly showed "Sankt Georg, Hamburg" instead of "Bristol" when the user was free (no events scheduled) after the foss-north trip ended on April 27. The previous logic required more than 3 days to pass before assuming return home from European countries, but for short European trips by rail/ferry, users typically return within 1-2 days. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
57 lines
1.4 KiB
JavaScript
57 lines
1.4 KiB
JavaScript
import {Class} from './Class';
|
|
|
|
/*
|
|
L.Handler is a base class for handler classes that are used internally to inject
|
|
interaction features like dragging to classes like Map and Marker.
|
|
*/
|
|
|
|
// @class Handler
|
|
// @aka L.Handler
|
|
// Abstract class for map interaction handlers
|
|
|
|
export var Handler = Class.extend({
|
|
initialize: function (map) {
|
|
this._map = map;
|
|
},
|
|
|
|
// @method enable(): this
|
|
// Enables the handler
|
|
enable: function () {
|
|
if (this._enabled) { return this; }
|
|
|
|
this._enabled = true;
|
|
this.addHooks();
|
|
return this;
|
|
},
|
|
|
|
// @method disable(): this
|
|
// Disables the handler
|
|
disable: function () {
|
|
if (!this._enabled) { return this; }
|
|
|
|
this._enabled = false;
|
|
this.removeHooks();
|
|
return this;
|
|
},
|
|
|
|
// @method enabled(): Boolean
|
|
// Returns `true` if the handler is enabled
|
|
enabled: function () {
|
|
return !!this._enabled;
|
|
}
|
|
|
|
// @section Extension methods
|
|
// Classes inheriting from `Handler` must implement the two following methods:
|
|
// @method addHooks()
|
|
// Called when the handler is enabled, should add event hooks.
|
|
// @method removeHooks()
|
|
// Called when the handler is disabled, should remove the event hooks added previously.
|
|
});
|
|
|
|
// @section There is static function which can be called without instantiating L.Handler:
|
|
// @function addTo(map: Map, name: String): this
|
|
// Adds a new Handler to the given map with the given name.
|
|
Handler.addTo = function (map, name) {
|
|
map.addHandler(name, this);
|
|
return this;
|
|
};
|