mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-08-20 14:34:38 +00:00
Update Renderer documentation to clarify tolerance option Canvas only (#7515)
* update renderer doc to clarify tolerance option Canvas only
* Revert "update renderer doc to clarify tolerance option Canvas only"
This reverts commit 6d9e82fc20
.
* moved tolerance option from Render to Canvas
* Refactor _clickTolerance
Co-authored-by: johnd0e <johnd0e@mail.ua>
Co-authored-by: johnd0e <johnd0e@mail.ua>
This commit is contained in:
@ -38,6 +38,15 @@ import {Bounds} from '../../geometry/Bounds';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export var Canvas = Renderer.extend({
|
export var Canvas = Renderer.extend({
|
||||||
|
|
||||||
|
// @section
|
||||||
|
// @aka Canvas options
|
||||||
|
options: {
|
||||||
|
// @option tolerance: Number = 0
|
||||||
|
// How much to extend the click tolerance around a path/object on the map.
|
||||||
|
tolerance: 0
|
||||||
|
},
|
||||||
|
|
||||||
getEvents: function () {
|
getEvents: function () {
|
||||||
var events = Renderer.prototype.getEvents.call(this);
|
var events = Renderer.prototype.getEvents.call(this);
|
||||||
events.viewprereset = this._onViewPreReset;
|
events.viewprereset = this._onViewPreReset;
|
||||||
|
@ -142,6 +142,7 @@ export var Path = Layer.extend({
|
|||||||
|
|
||||||
_clickTolerance: function () {
|
_clickTolerance: function () {
|
||||||
// used when doing hit detection for Canvas layers
|
// used when doing hit detection for Canvas layers
|
||||||
return (this.options.stroke ? this.options.weight / 2 : 0) + this._renderer.options.tolerance;
|
return (this.options.stroke ? this.options.weight / 2 : 0) +
|
||||||
|
(this._renderer.options.tolerance || 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -34,11 +34,7 @@ export var Renderer = Layer.extend({
|
|||||||
// @option padding: Number = 0.1
|
// @option padding: Number = 0.1
|
||||||
// How much to extend the clip area around the map view (relative to its size)
|
// How much to extend the clip area around the map view (relative to its size)
|
||||||
// e.g. 0.1 would be 10% of map view in each direction
|
// e.g. 0.1 would be 10% of map view in each direction
|
||||||
padding: 0.1,
|
padding: 0.1
|
||||||
|
|
||||||
// @option tolerance: Number = 0
|
|
||||||
// How much to extend click tolerance round a path/object on the map
|
|
||||||
tolerance : 0
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
|
Reference in New Issue
Block a user