diff --git a/classes/Cluster.html b/classes/Cluster.html index 3888f17f..5e680fa4 100644 --- a/classes/Cluster.html +++ b/classes/Cluster.html @@ -1,7 +1,7 @@ -Cluster | @googlemaps/js-markerclusterer
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Cluster

Index

Constructors

Properties

_position: LatLng
marker: Marker
markers?: Marker[]

Accessors

  • get bounds(): LatLngBounds
  • get count(): number

Hierarchy

  • ClusterStats

Index

Constructors

Properties

Constructors

Properties

clusters: { count: number; markers: { max: number; mean: number; min: number; sum: number } }

Type declaration

  • count: number
  • markers: { max: number; mean: number; min: number; sum: number }
    • max: number
    • mean: number
    • min: number
    • sum: number
markers: { sum: number }

Type declaration

  • sum: number

Generated using TypeDoc

\ No newline at end of file diff --git a/classes/DefaultRenderer.html b/classes/DefaultRenderer.html index 750d0ec7..ed97e7af 100644 --- a/classes/DefaultRenderer.html +++ b/classes/DefaultRenderer.html @@ -1,4 +1,4 @@ -DefaultRenderer | @googlemaps/js-markerclusterer
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • DefaultRenderer

Implements

Index

Constructors

Methods

Constructors

Methods

  • +DefaultRenderer | @googlemaps/js-markerclusterer
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • DefaultRenderer

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • The default render function for the library used by MarkerClusterer.

      Currently set to use the following:

      // change color if this cluster has more markers than the mean cluster
      const color =
      count > Math.max(10, stats.clusters.markers.mean)
      ? "#ff0000"
      : "#0000ff";

      // create svg url with fill color
      const svg = window.btoa(`
      <svg fill="${color}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240">
      <circle cx="120" cy="120" opacity=".6" r="70" />
      <circle cx="120" cy="120" opacity=".3" r="90" />
      <circle cx="120" cy="120" opacity=".2" r="110" />
      <circle cx="120" cy="120" opacity=".1" r="130" />
      </svg>`);

      // create marker using svg icon
      return new google.maps.Marker({
      position,
      icon: {
      url: `data:image/svg+xml;base64,${svg}`,
      scaledSize: new google.maps.Size(45, 45),
      },
      label: {
      text: String(count),
      color: "rgba(255,255,255,0.9)",
      fontSize: "12px",
      },
      // adjust zIndex to be above other markers
      zIndex: 1000 + count,
      }); diff --git a/classes/GridAlgorithm.html b/classes/GridAlgorithm.html index dacc4a51..ace0b3ef 100644 --- a/classes/GridAlgorithm.html +++ b/classes/GridAlgorithm.html @@ -3,7 +3,7 @@ clustering.

      The Grid algorithm does not implement caching and markers may flash as the viewport changes. Instead use SuperClusterAlgorithm.

      -

    Hierarchy

    • AbstractViewportAlgorithm
      • GridAlgorithm

    Index

    Constructors

    Properties

    clusters: Cluster[] = []
    gridSize: number
    maxDistance: number
    maxZoom: number
    viewportPadding: number = 60

    Methods

    • addToClosestCluster(marker: Marker, map: Map, projection: MapCanvasProjection): void
    • Parameters

      • marker: Marker
      • map: Map
      • projection: MapCanvasProjection

      Returns void

    Hierarchy

    • AbstractViewportAlgorithm
      • GridAlgorithm

    Index

    Constructors

    Properties

    clusters: Cluster[] = []
    gridSize: number
    maxDistance: number
    maxZoom: number
    viewportPadding: number = 60

    Methods

    • addToClosestCluster(marker: Marker, map: Map, projection: MapCanvasProjection): void
    • Parameters

      • marker: Marker
      • map: Map
      • projection: MapCanvasProjection

      Returns void

    • renderClusters(): void
    • reset(): void

    Legend

    • Constructor
    • Property
    • Method
    • Property
    • Method
    • Protected property
    • Protected method
    • Inherited method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/classes/NoopAlgorithm.html b/classes/NoopAlgorithm.html index 9e6beaec..7957e78a 100644 --- a/classes/NoopAlgorithm.html +++ b/classes/NoopAlgorithm.html @@ -1,6 +1,6 @@ NoopAlgorithm | @googlemaps/js-markerclusterer
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Noop algorithm does not generate any clusters or filter markers by the an extended viewport.

    -

    Hierarchy

    • AbstractAlgorithm
      • NoopAlgorithm

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    maxZoom: number

    Methods

    Hierarchy

    • AbstractAlgorithm
      • NoopAlgorithm

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    maxZoom: number

    Methods

    • transformCluster(__namedParameters: ClusterFeature<{ marker: Marker }>): Cluster

    Legend

    • Constructor
    • Property
    • Method
    • Property
    • Method
    • Protected property
    • Protected method
    • Inherited method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/dist/index.dev.js b/dist/index.dev.js index 462e2a05..b75cff29 100644 --- a/dist/index.dev.js +++ b/dist/index.dev.js @@ -181,7 +181,7 @@ var markerClusterer = (function (exports) { }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 - var global$v = // eslint-disable-next-line es-x/no-global-this -- safe + var global$u = // eslint-disable-next-line es-x/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback function () { @@ -272,11 +272,11 @@ var markerClusterer = (function (exports) { return stringSlice(toString$5(it), 8, -1); }; - var global$u = global$v; + var global$t = global$u; var uncurryThis$h = functionUncurryThis; var fails$b = fails$e; var classof$7 = classofRaw$1; - var Object$4 = global$u.Object; + var Object$4 = global$t.Object; var split = uncurryThis$h(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings var indexedObject = fails$b(function () { @@ -287,8 +287,8 @@ var markerClusterer = (function (exports) { return classof$7(it) == 'String' ? split(it, '') : Object$4(it); } : Object$4; - var global$t = global$v; - var TypeError$c = global$t.TypeError; // `RequireObjectCoercible` abstract operation + var global$s = global$u; + var TypeError$c = global$s.TypeError; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible var requireObjectCoercible$4 = function (it) { @@ -315,7 +315,7 @@ var markerClusterer = (function (exports) { return typeof it == 'object' ? it !== null : isCallable$d(it); }; - var global$s = global$v; + var global$r = global$u; var isCallable$c = isCallable$e; var aFunction = function (argument) { @@ -323,7 +323,7 @@ var markerClusterer = (function (exports) { }; var getBuiltIn$5 = function (namespace, method) { - return arguments.length < 2 ? aFunction(global$s[namespace]) : global$s[namespace] && global$s[namespace][method]; + return arguments.length < 2 ? aFunction(global$r[namespace]) : global$r[namespace] && global$r[namespace][method]; }; var uncurryThis$g = functionUncurryThis; @@ -332,10 +332,10 @@ var markerClusterer = (function (exports) { var getBuiltIn$4 = getBuiltIn$5; var engineUserAgent = getBuiltIn$4('navigator', 'userAgent') || ''; - var global$r = global$v; + var global$q = global$u; var userAgent = engineUserAgent; - var process = global$r.process; - var Deno = global$r.Deno; + var process = global$q.process; + var Deno = global$q.Deno; var versions = process && process.versions || Deno && Deno.version; var v8 = versions && versions.v8; var match, version; @@ -376,12 +376,12 @@ var markerClusterer = (function (exports) { var NATIVE_SYMBOL$1 = nativeSymbol; var useSymbolAsUid = NATIVE_SYMBOL$1 && !Symbol.sham && typeof Symbol.iterator == 'symbol'; - var global$q = global$v; + var global$p = global$u; var getBuiltIn$3 = getBuiltIn$5; var isCallable$b = isCallable$e; var isPrototypeOf$1 = objectIsPrototypeOf; var USE_SYMBOL_AS_UID$1 = useSymbolAsUid; - var Object$3 = global$q.Object; + var Object$3 = global$p.Object; var isSymbol$3 = USE_SYMBOL_AS_UID$1 ? function (it) { return typeof it == 'symbol'; } : function (it) { @@ -389,8 +389,8 @@ var markerClusterer = (function (exports) { return isCallable$b($Symbol) && isPrototypeOf$1($Symbol.prototype, Object$3(it)); }; - var global$p = global$v; - var String$4 = global$p.String; + var global$o = global$u; + var String$4 = global$o.String; var tryToString$1 = function (argument) { try { @@ -400,10 +400,10 @@ var markerClusterer = (function (exports) { } }; - var global$o = global$v; + var global$n = global$u; var isCallable$a = isCallable$e; var tryToString = tryToString$1; - var TypeError$b = global$o.TypeError; // `Assert: IsCallable(argument) is true` + var TypeError$b = global$n.TypeError; // `Assert: IsCallable(argument) is true` var aCallable$3 = function (argument) { if (isCallable$a(argument)) return argument; @@ -418,11 +418,11 @@ var markerClusterer = (function (exports) { return func == null ? undefined : aCallable$2(func); }; - var global$n = global$v; + var global$m = global$u; var call$4 = functionCall; var isCallable$9 = isCallable$e; var isObject$7 = isObject$8; - var TypeError$a = global$n.TypeError; // `OrdinaryToPrimitive` abstract operation + var TypeError$a = global$m.TypeError; // `OrdinaryToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-ordinarytoprimitive var ordinaryToPrimitive$1 = function (input, pref) { @@ -435,44 +435,44 @@ var markerClusterer = (function (exports) { var shared$3 = {exports: {}}; - var global$m = global$v; // eslint-disable-next-line es-x/no-object-defineproperty -- safe + var global$l = global$u; // eslint-disable-next-line es-x/no-object-defineproperty -- safe - var defineProperty$3 = Object.defineProperty; + var defineProperty$4 = Object.defineProperty; - var setGlobal$3 = function (key, value) { + var defineGlobalProperty$3 = function (key, value) { try { - defineProperty$3(global$m, key, { + defineProperty$4(global$l, key, { value: value, configurable: true, writable: true }); } catch (error) { - global$m[key] = value; + global$l[key] = value; } return value; }; - var global$l = global$v; - var setGlobal$2 = setGlobal$3; + var global$k = global$u; + var defineGlobalProperty$2 = defineGlobalProperty$3; var SHARED = '__core-js_shared__'; - var store$3 = global$l[SHARED] || setGlobal$2(SHARED, {}); + var store$3 = global$k[SHARED] || defineGlobalProperty$2(SHARED, {}); var sharedStore = store$3; var store$2 = sharedStore; (shared$3.exports = function (key, value) { return store$2[key] || (store$2[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.22.5', + version: '3.22.6', mode: 'global', copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)', - license: 'https://github.com/zloirock/core-js/blob/v3.22.5/LICENSE', + license: 'https://github.com/zloirock/core-js/blob/v3.22.6/LICENSE', source: 'https://github.com/zloirock/core-js' }); - var global$k = global$v; + var global$j = global$u; var requireObjectCoercible$2 = requireObjectCoercible$4; - var Object$2 = global$k.Object; // `ToObject` abstract operation + var Object$2 = global$j.Object; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject var toObject$5 = function (argument) { @@ -498,14 +498,14 @@ var markerClusterer = (function (exports) { return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$4(++id + postfix, 36); }; - var global$j = global$v; + var global$i = global$u; var shared$2 = shared$3.exports; var hasOwn$7 = hasOwnProperty_1; var uid$1 = uid$2; var NATIVE_SYMBOL = nativeSymbol; var USE_SYMBOL_AS_UID = useSymbolAsUid; var WellKnownSymbolsStore = shared$2('wks'); - var Symbol$1 = global$j.Symbol; + var Symbol$1 = global$i.Symbol; var symbolFor = Symbol$1 && Symbol$1['for']; var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1; @@ -525,14 +525,14 @@ var markerClusterer = (function (exports) { return WellKnownSymbolsStore[name]; }; - var global$i = global$v; + var global$h = global$u; var call$3 = functionCall; var isObject$6 = isObject$8; var isSymbol$2 = isSymbol$3; var getMethod = getMethod$1; var ordinaryToPrimitive = ordinaryToPrimitive$1; var wellKnownSymbol$7 = wellKnownSymbol$8; - var TypeError$9 = global$i.TypeError; + var TypeError$9 = global$h.TypeError; var TO_PRIMITIVE = wellKnownSymbol$7('toPrimitive'); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive @@ -561,9 +561,9 @@ var markerClusterer = (function (exports) { return isSymbol$1(key) ? key : key + ''; }; - var global$h = global$v; + var global$g = global$u; var isObject$5 = isObject$8; - var document$1 = global$h.document; // typeof document.createElement is 'object' in old IE + var document$1 = global$g.document; // typeof document.createElement is 'object' in old IE var EXISTS$1 = isObject$5(document$1) && isObject$5(document$1.createElement); @@ -623,23 +623,23 @@ var markerClusterer = (function (exports) { }).prototype != 42; }); - var global$g = global$v; + var global$f = global$u; var isObject$4 = isObject$8; - var String$3 = global$g.String; - var TypeError$8 = global$g.TypeError; // `Assert: Type(argument) is Object` + var String$3 = global$f.String; + var TypeError$8 = global$f.TypeError; // `Assert: Type(argument) is Object` var anObject$5 = function (argument) { if (isObject$4(argument)) return argument; throw TypeError$8(String$3(argument) + ' is not an object'); }; - var global$f = global$v; + var global$e = global$u; var DESCRIPTORS$6 = descriptors; var IE8_DOM_DEFINE = ie8DomDefine; var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug; var anObject$4 = anObject$5; var toPropertyKey$1 = toPropertyKey$3; - var TypeError$7 = global$f.TypeError; // eslint-disable-next-line es-x/no-object-defineproperty -- safe + var TypeError$7 = global$e.TypeError; // eslint-disable-next-line es-x/no-object-defineproperty -- safe var $defineProperty = Object.defineProperty; // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe @@ -683,10 +683,10 @@ var markerClusterer = (function (exports) { }; var DESCRIPTORS$5 = descriptors; - var definePropertyModule$4 = objectDefineProperty; + var definePropertyModule$3 = objectDefineProperty; var createPropertyDescriptor$1 = createPropertyDescriptor$3; var createNonEnumerableProperty$4 = DESCRIPTORS$5 ? function (object, key, value) { - return definePropertyModule$4.f(object, key, createPropertyDescriptor$1(1, value)); + return definePropertyModule$3.f(object, key, createPropertyDescriptor$1(1, value)); } : function (object, key, value) { object[key] = value; return object; @@ -725,10 +725,10 @@ var markerClusterer = (function (exports) { var inspectSource$3 = store$1.inspectSource; - var global$e = global$v; + var global$d = global$u; var isCallable$7 = isCallable$e; var inspectSource$2 = inspectSource$3; - var WeakMap$1 = global$e.WeakMap; + var WeakMap$1 = global$d.WeakMap; var nativeWeakMap = isCallable$7(WeakMap$1) && /native code/.test(inspectSource$2(WeakMap$1)); var shared$1 = shared$3.exports; @@ -742,7 +742,7 @@ var markerClusterer = (function (exports) { var hiddenKeys$4 = {}; var NATIVE_WEAK_MAP = nativeWeakMap; - var global$d = global$v; + var global$c = global$u; var uncurryThis$c = functionUncurryThis; var isObject$3 = isObject$8; var createNonEnumerableProperty$3 = createNonEnumerableProperty$4; @@ -751,8 +751,8 @@ var markerClusterer = (function (exports) { var sharedKey$1 = sharedKey$2; var hiddenKeys$3 = hiddenKeys$4; var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; - var TypeError$6 = global$d.TypeError; - var WeakMap = global$d.WeakMap; + var TypeError$6 = global$c.TypeError; + var WeakMap = global$c.WeakMap; var set, get, has; var enforce = function (it) { @@ -829,9 +829,9 @@ var markerClusterer = (function (exports) { var enforceInternalState = InternalStateModule.enforce; var getInternalState = InternalStateModule.get; // eslint-disable-next-line es-x/no-object-defineproperty -- safe - var defineProperty$2 = Object.defineProperty; + var defineProperty$3 = Object.defineProperty; var CONFIGURABLE_LENGTH = DESCRIPTORS$3 && !fails$7(function () { - return defineProperty$2(function () { + return defineProperty$3(function () { /* empty */ }, 'length', { value: 8 @@ -848,21 +848,21 @@ var markerClusterer = (function (exports) { if (options && options.setter) name = 'set ' + name; if (!hasOwn$3(value, 'name') || CONFIGURABLE_FUNCTION_NAME && value.name !== name) { - defineProperty$2(value, 'name', { + defineProperty$3(value, 'name', { value: name, configurable: true }); } if (CONFIGURABLE_LENGTH && options && hasOwn$3(options, 'arity') && value.length !== options.arity) { - defineProperty$2(value, 'length', { + defineProperty$3(value, 'length', { value: options.arity }); } if (options && hasOwn$3(options, 'constructor') && options.constructor) { if (DESCRIPTORS$3) try { - defineProperty$2(value, 'prototype', { + defineProperty$3(value, 'prototype', { writable: false }); } catch (error) { @@ -885,42 +885,46 @@ var markerClusterer = (function (exports) { return isCallable$6(this) && getInternalState(this).source || inspectSource$1(this); }, 'toString'); - var global$c = global$v; var isCallable$5 = isCallable$e; var createNonEnumerableProperty$2 = createNonEnumerableProperty$4; var makeBuiltIn = makeBuiltIn$2.exports; - var setGlobal$1 = setGlobal$3; + var defineGlobalProperty$1 = defineGlobalProperty$3; var defineBuiltIn$3 = function (O, key, value, options) { - var unsafe = options ? !!options.unsafe : false; - var simple = options ? !!options.enumerable : false; - var noTargetGet = options ? !!options.noTargetGet : false; - var name = options && options.name !== undefined ? options.name : key; + if (!options) options = {}; + var simple = options.enumerable; + var name = options.name !== undefined ? options.name : key; if (isCallable$5(value)) makeBuiltIn(value, name, options); - if (O === global$c) { - if (simple) O[key] = value;else setGlobal$1(key, value); - return O; - } else if (!unsafe) { - delete O[key]; - } else if (!noTargetGet && O[key]) { - simple = true; + if (options.global) { + if (simple) O[key] = value;else defineGlobalProperty$1(key, value); + } else { + if (!options.unsafe) delete O[key];else if (O[key]) simple = true; + if (simple) O[key] = value;else createNonEnumerableProperty$2(O, key, value); } - if (simple) O[key] = value;else createNonEnumerableProperty$2(O, key, value); return O; }; var objectGetOwnPropertyNames = {}; var ceil = Math.ceil; - var floor = Math.floor; // `ToIntegerOrInfinity` abstract operation + var floor = Math.floor; // `Math.trunc` method + // https://tc39.es/ecma262/#sec-math.trunc + // eslint-disable-next-line es-x/no-math-trunc -- safe + + var mathTrunc = Math.trunc || function trunc(x) { + var n = +x; + return (n > 0 ? floor : ceil)(n); + }; + + var trunc = mathTrunc; // `ToIntegerOrInfinity` abstract operation // https://tc39.es/ecma262/#sec-tointegerorinfinity var toIntegerOrInfinity$3 = function (argument) { - var number = +argument; // eslint-disable-next-line no-self-compare -- safe + var number = +argument; // eslint-disable-next-line no-self-compare -- NaN check - return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number); + return number !== number || number === 0 ? 0 : trunc(number); }; var toIntegerOrInfinity$2 = toIntegerOrInfinity$3; @@ -1036,11 +1040,11 @@ var markerClusterer = (function (exports) { var hasOwn$1 = hasOwnProperty_1; var ownKeys = ownKeys$1; var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor; - var definePropertyModule$3 = objectDefineProperty; + var definePropertyModule$2 = objectDefineProperty; var copyConstructorProperties$1 = function (target, source, exceptions) { var keys = ownKeys(source); - var defineProperty = definePropertyModule$3.f; + var defineProperty = definePropertyModule$2.f; var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; for (var i = 0; i < keys.length; i++) { @@ -1070,27 +1074,27 @@ var markerClusterer = (function (exports) { var POLYFILL = isForced$2.POLYFILL = 'P'; var isForced_1 = isForced$2; - var global$b = global$v; + var global$b = global$u; var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; var createNonEnumerableProperty$1 = createNonEnumerableProperty$4; var defineBuiltIn$2 = defineBuiltIn$3; - var setGlobal = setGlobal$3; + var defineGlobalProperty = defineGlobalProperty$3; var copyConstructorProperties = copyConstructorProperties$1; var isForced$1 = isForced_1; /* - options.target - name of the target object - options.global - target is the global object - options.stat - export as static methods of target - options.proto - export as prototype methods of target - options.real - real prototype method for the `pure` version - options.forced - export even if the native feature is available - options.bind - bind methods to the target, required for the `pure` version - options.wrap - wrap constructors to preventing global pollution, required for the `pure` version - options.unsafe - use the simple assignment of property instead of delete + defineProperty - options.sham - add a flag to not completely full polyfills - options.enumerable - export as enumerable property - options.noTargetGet - prevent calling a getter on target - options.name - the .name of the function if it does not match the key + options.target - name of the target object + options.global - target is the global object + options.stat - export as static methods of target + options.proto - export as prototype methods of target + options.real - real prototype method for the `pure` version + options.forced - export even if the native feature is available + options.bind - bind methods to the target, required for the `pure` version + options.wrap - wrap constructors to preventing global pollution, required for the `pure` version + options.unsafe - use the simple assignment of property instead of delete + defineProperty + options.sham - add a flag to not completely full polyfills + options.enumerable - export as enumerable property + options.dontCallGetSet - prevent calling a getter on target + options.name - the .name of the function if it does not match the key */ var _export = function (options, source) { @@ -1102,7 +1106,7 @@ var markerClusterer = (function (exports) { if (GLOBAL) { target = global$b; } else if (STATIC) { - target = global$b[TARGET] || setGlobal(TARGET, {}); + target = global$b[TARGET] || defineGlobalProperty(TARGET, {}); } else { target = (global$b[TARGET] || {}).prototype; } @@ -1110,7 +1114,7 @@ var markerClusterer = (function (exports) { if (target) for (key in source) { sourceProperty = source[key]; - if (options.noTargetGet) { + if (options.dontCallGetSet) { descriptor = getOwnPropertyDescriptor$1(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; @@ -1159,7 +1163,7 @@ var markerClusterer = (function (exports) { test[TO_STRING_TAG$1] = 'z'; var toStringTagSupport = String(test) === '[object z]'; - var global$a = global$v; + var global$a = global$u; var TO_STRING_TAG_SUPPORT$2 = toStringTagSupport; var isCallable$3 = isCallable$e; var classofRaw = classofRaw$1; @@ -1246,7 +1250,7 @@ var markerClusterer = (function (exports) { }) || called; }) ? isConstructorLegacy : isConstructorModern; - var global$9 = global$v; + var global$9 = global$u; var isArray = isArray$1; var isConstructor = isConstructor$1; var isObject$2 = isObject$8; @@ -1435,7 +1439,7 @@ var markerClusterer = (function (exports) { return t; } - var global$8 = global$v; + var global$8 = global$u; var aCallable = aCallable$3; var toObject$2 = toObject$5; var IndexedObject$1 = indexedObject; @@ -1494,7 +1498,7 @@ var markerClusterer = (function (exports) { }; var classof$3 = classofRaw$1; - var global$7 = global$v; + var global$7 = global$u; var engineIsNode = classof$3(global$7.process) == 'process'; var $$7 = _export; @@ -1896,7 +1900,7 @@ var markerClusterer = (function (exports) { return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe } : [].forEach; - var global$6 = global$v; + var global$6 = global$u; var DOMIterables = domIterables; var DOMTokenListPrototype = domTokenListPrototype; var forEach = arrayForEach; @@ -2073,7 +2077,7 @@ var markerClusterer = (function (exports) { var $assign = Object.assign; // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing - var defineProperty$1 = Object.defineProperty; + var defineProperty$2 = Object.defineProperty; var concat = uncurryThis$6([].concat); // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign @@ -2081,10 +2085,10 @@ var markerClusterer = (function (exports) { // should have correct order of operations (Edge bug) if (DESCRIPTORS$2 && $assign({ b: 1 - }, $assign(defineProperty$1({}, 'a', { + }, $assign(defineProperty$2({}, 'a', { enumerable: true, get: function () { - defineProperty$1(this, 'b', { + defineProperty$2(this, 'b', { value: 3, enumerable: false }); @@ -2955,7 +2959,7 @@ var markerClusterer = (function (exports) { var DESCRIPTORS$1 = descriptors; var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug; - var definePropertyModule$2 = objectDefineProperty; + var definePropertyModule$1 = objectDefineProperty; var anObject$2 = anObject$5; var toIndexedObject = toIndexedObject$4; var objectKeys = objectKeys$2; // `Object.defineProperties` method @@ -2970,7 +2974,7 @@ var markerClusterer = (function (exports) { var index = 0; var key; - while (length > index) definePropertyModule$2.f(O, key = keys[index++], props[key]); + while (length > index) definePropertyModule$1.f(O, key = keys[index++], props[key]); return O; }; @@ -3071,13 +3075,13 @@ var markerClusterer = (function (exports) { var wellKnownSymbol$2 = wellKnownSymbol$8; var create = objectCreate; - var definePropertyModule$1 = objectDefineProperty; + var defineProperty$1 = objectDefineProperty.f; var UNSCOPABLES = wellKnownSymbol$2('unscopables'); var ArrayPrototype = Array.prototype; // Array.prototype[@@unscopables] // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables if (ArrayPrototype[UNSCOPABLES] == undefined) { - definePropertyModule$1.f(ArrayPrototype, UNSCOPABLES, { + defineProperty$1(ArrayPrototype, UNSCOPABLES, { configurable: true, value: create(null) }); @@ -3123,7 +3127,7 @@ var markerClusterer = (function (exports) { return isObject$1(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$1(it) == 'RegExp'); }; - var global$5 = global$v; + var global$5 = global$u; var isRegExp = isRegexp; var TypeError$4 = global$5.TypeError; @@ -3135,7 +3139,7 @@ var markerClusterer = (function (exports) { return it; }; - var global$4 = global$v; + var global$4 = global$u; var classof = classof$5; var String$2 = global$4.String; @@ -3221,7 +3225,7 @@ var markerClusterer = (function (exports) { }; var $ = _export; - var global$3 = global$v; + var global$3 = global$u; var toAbsoluteIndex = toAbsoluteIndex$2; var toIntegerOrInfinity = toIntegerOrInfinity$3; var lengthOfArrayLike = lengthOfArrayLike$4; @@ -3300,7 +3304,7 @@ var markerClusterer = (function (exports) { } }); - var global$2 = global$v; + var global$2 = global$u; var isCallable$1 = isCallable$e; var String$1 = global$2.String; var TypeError$2 = global$2.TypeError; @@ -3390,7 +3394,7 @@ var markerClusterer = (function (exports) { }; var DESCRIPTORS = descriptors; - var global$1 = global$v; + var global$1 = global$u; var uncurryThis = functionUncurryThis; var isForced = isForced_1; var defineBuiltIn = defineBuiltIn$3; diff --git a/dist/index.min.js b/dist/index.min.js index d5774ac7..1c8a6d97 100644 --- a/dist/index.min.js +++ b/dist/index.min.js @@ -1,2 +1,2 @@ -var markerClusterer=function(t){"use strict";function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&E[0]<4?1:+(E[0]+E[1])),!j&&st&&(!(E=st.match(/Edge\/(\d+)/))||E[1]>=74)&&(E=st.match(/Chrome\/(\d+)/))&&(j=+E[1]);var lt=j,pt=lt,ht=v,mt=!!Object.getOwnPropertySymbols&&!ht((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&pt&&pt<41})),dt=mt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,gt=nt,vt=K,yt=ot,bt=dt,wt=d.Object,kt=bt?function(t){return"symbol"==typeof t}:function(t){var e=gt("Symbol");return vt(e)&&yt(e.prototype,wt(t))},Ot=d.String,St=K,xt=function(t){try{return Ot(t)}catch(t){return"Object"}},Mt=d.TypeError,Pt=function(t){if(St(t))return t;throw Mt(xt(t)+" is not a function")},Et=Pt,jt=O,Ct=K,_t=Q,Lt=d.TypeError,Tt={exports:{}},It=d,At=Object.defineProperty,Nt=function(t,e){try{At(It,t,{value:e,configurable:!0,writable:!0})}catch(r){It[t]=e}return e},zt=Nt,Rt="__core-js_shared__",Ft=d[Rt]||zt(Rt,{}),Zt=Ft;(Tt.exports=function(t,e){return Zt[t]||(Zt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.22.5",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.22.5/LICENSE",source:"https://github.com/zloirock/core-js"});var Dt=X,Gt=d.Object,Vt=function(t){return Gt(Dt(t))},Bt=Vt,Ut=N({}.hasOwnProperty),Wt=Object.hasOwn||function(t,e){return Ut(Bt(t),e)},qt=N,Xt=0,Ht=Math.random(),$t=qt(1..toString),Jt=function(t){return"Symbol("+(void 0===t?"":t)+")_"+$t(++Xt+Ht,36)},Kt=d,Yt=Tt.exports,Qt=Wt,te=Jt,ee=mt,re=dt,ne=Yt("wks"),oe=Kt.Symbol,ie=oe&&oe.for,se=re?oe:oe&&oe.withoutSetter||te,ae=function(t){if(!Qt(ne,t)||!ee&&"string"!=typeof ne[t]){var e="Symbol."+t;ee&&Qt(oe,t)?ne[t]=oe[t]:ne[t]=re&&ie?ie(e):se(e)}return ne[t]},ue=O,ce=Q,fe=kt,le=function(t,e){var r=t[e];return null==r?void 0:Et(r)},pe=function(t,e){var r,n;if("string"===e&&Ct(r=t.toString)&&!_t(n=jt(r,t)))return n;if(Ct(r=t.valueOf)&&!_t(n=jt(r,t)))return n;if("string"!==e&&Ct(r=t.toString)&&!_t(n=jt(r,t)))return n;throw Lt("Can't convert object to primitive value")},he=ae,me=d.TypeError,de=he("toPrimitive"),ge=function(t,e){if(!ce(t)||fe(t))return t;var r,n=le(t,de);if(n){if(void 0===e&&(e="default"),r=ue(n,t,e),!ce(r)||fe(r))return r;throw me("Can't convert object to primitive value")}return void 0===e&&(e="number"),pe(t,e)},ve=ge,ye=kt,be=function(t){var e=ve(t,"string");return ye(e)?e:e+""},we=Q,ke=d.document,Oe=we(ke)&&we(ke.createElement),Se=function(t){return Oe?ke.createElement(t):{}},xe=Se,Me=!y&&!v((function(){return 7!=Object.defineProperty(xe("div"),"a",{get:function(){return 7}}).a})),Pe=y,Ee=O,je=S,Ce=C,_e=J,Le=be,Te=Wt,Ie=Me,Ae=Object.getOwnPropertyDescriptor;g.f=Pe?Ae:function(t,e){if(t=_e(t),e=Le(e),Ie)try{return Ae(t,e)}catch(t){}if(Te(t,e))return Ce(!Ee(je.f,t,e),t[e])};var Ne={},ze=y&&v((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Re=d,Fe=Q,Ze=Re.String,De=Re.TypeError,Ge=function(t){if(Fe(t))return t;throw De(Ze(t)+" is not an object")},Ve=y,Be=Me,Ue=ze,We=Ge,qe=be,Xe=d.TypeError,He=Object.defineProperty,$e=Object.getOwnPropertyDescriptor,Je="enumerable",Ke="configurable",Ye="writable";Ne.f=Ve?Ue?function(t,e,r){if(We(t),e=qe(e),We(r),"function"==typeof t&&"prototype"===e&&"value"in r&&Ye in r&&!r.writable){var n=$e(t,e);n&&n.writable&&(t[e]=r.value,r={configurable:Ke in r?r.configurable:n.configurable,enumerable:Je in r?r.enumerable:n.enumerable,writable:!1})}return He(t,e,r)}:He:function(t,e,r){if(We(t),e=qe(e),We(r),Be)try{return He(t,e,r)}catch(t){}if("get"in r||"set"in r)throw Xe("Accessors not supported");return"value"in r&&(t[e]=r.value),t};var Qe=Ne,tr=C,er=y?function(t,e,r){return Qe.f(t,e,tr(1,r))}:function(t,e,r){return t[e]=r,t},rr={exports:{}},nr=y,or=Wt,ir=Function.prototype,sr=nr&&Object.getOwnPropertyDescriptor,ar=or(ir,"name"),ur={EXISTS:ar,PROPER:ar&&"something"===function(){}.name,CONFIGURABLE:ar&&(!nr||nr&&sr(ir,"name").configurable)},cr=K,fr=Ft,lr=N(Function.toString);cr(fr.inspectSource)||(fr.inspectSource=function(t){return lr(t)});var pr,hr,mr,dr=fr.inspectSource,gr=K,vr=dr,yr=d.WeakMap,br=gr(yr)&&/native code/.test(vr(yr)),wr=Tt.exports,kr=Jt,Or=wr("keys"),Sr=function(t){return Or[t]||(Or[t]=kr(t))},xr={},Mr=br,Pr=d,Er=N,jr=Q,Cr=er,_r=Wt,Lr=Ft,Tr=Sr,Ir=xr,Ar="Object already initialized",Nr=Pr.TypeError,zr=Pr.WeakMap;if(Mr||Lr.state){var Rr=Lr.state||(Lr.state=new zr),Fr=Er(Rr.get),Zr=Er(Rr.has),Dr=Er(Rr.set);pr=function(t,e){if(Zr(Rr,t))throw new Nr(Ar);return e.facade=t,Dr(Rr,t,e),e},hr=function(t){return Fr(Rr,t)||{}},mr=function(t){return Zr(Rr,t)}}else{var Gr=Tr("state");Ir[Gr]=!0,pr=function(t,e){if(_r(t,Gr))throw new Nr(Ar);return e.facade=t,Cr(t,Gr,e),e},hr=function(t){return _r(t,Gr)?t[Gr]:{}},mr=function(t){return _r(t,Gr)}}var Vr={set:pr,get:hr,has:mr,enforce:function(t){return mr(t)?hr(t):pr(t,{})},getterFor:function(t){return function(e){var r;if(!jr(e)||(r=hr(e)).type!==t)throw Nr("Incompatible receiver, "+t+" required");return r}}},Br=v,Ur=K,Wr=Wt,qr=y,Xr=ur.CONFIGURABLE,Hr=dr,$r=Vr.enforce,Jr=Vr.get,Kr=Object.defineProperty,Yr=qr&&!Br((function(){return 8!==Kr((function(){}),"length",{value:8}).length})),Qr=String(String).split("String"),tn=rr.exports=function(t,e,r){if("Symbol("===String(e).slice(0,7)&&(e="["+String(e).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(e="get "+e),r&&r.setter&&(e="set "+e),(!Wr(t,"name")||Xr&&t.name!==e)&&Kr(t,"name",{value:e,configurable:!0}),Yr&&r&&Wr(r,"arity")&&t.length!==r.arity&&Kr(t,"length",{value:r.arity}),r&&Wr(r,"constructor")&&r.constructor){if(qr)try{Kr(t,"prototype",{writable:!1})}catch(t){}}else t.prototype=void 0;var n=$r(t);return Wr(n,"source")||(n.source=Qr.join("string"==typeof e?e:"")),t};Function.prototype.toString=tn((function(){return Ur(this)&&Jr(this).source||Hr(this)}),"toString");var en=d,rn=K,nn=er,on=rr.exports,sn=Nt,an=function(t,e,r,n){var o=!!n&&!!n.unsafe,i=!!n&&!!n.enumerable,s=!!n&&!!n.noTargetGet,a=n&&void 0!==n.name?n.name:e;return rn(r)&&on(r,a,n),t===en?(i?t[e]=r:sn(e,r),t):(o?!s&&t[e]&&(i=!0):delete t[e],i?t[e]=r:nn(t,e,r),t)},un={},cn=Math.ceil,fn=Math.floor,ln=function(t){var e=+t;return e!=e||0===e?0:(e>0?fn:cn)(e)},pn=ln,hn=Math.max,mn=Math.min,dn=function(t,e){var r=pn(t);return r<0?hn(r+e,0):mn(r,e)},gn=ln,vn=Math.min,yn=function(t){return t>0?vn(gn(t),9007199254740991):0},bn=function(t){return yn(t.length)},wn=J,kn=dn,On=bn,Sn=function(t){return function(e,r,n){var o,i=wn(e),s=On(i),a=kn(n,s);if(t&&r!=r){for(;s>a;)if((o=i[a++])!=o)return!0}else for(;s>a;a++)if((t||a in i)&&i[a]===r)return t||a||0;return!t&&-1}},xn={includes:Sn(!0),indexOf:Sn(!1)},Mn=Wt,Pn=J,En=xn.indexOf,jn=xr,Cn=N([].push),_n=function(t,e){var r,n=Pn(t),o=0,i=[];for(r in n)!Mn(jn,r)&&Mn(n,r)&&Cn(i,r);for(;e.length>o;)Mn(n,r=e[o++])&&(~En(i,r)||Cn(i,r));return i},Ln=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Tn=_n,In=Ln.concat("length","prototype");un.f=Object.getOwnPropertyNames||function(t){return Tn(t,In)};var An={};An.f=Object.getOwnPropertySymbols;var Nn=nt,zn=un,Rn=An,Fn=Ge,Zn=N([].concat),Dn=Nn("Reflect","ownKeys")||function(t){var e=zn.f(Fn(t)),r=Rn.f;return r?Zn(e,r(t)):e},Gn=Wt,Vn=Dn,Bn=g,Un=Ne,Wn=v,qn=K,Xn=/#|\.prototype\./,Hn=function(t,e){var r=Jn[$n(t)];return r==Yn||r!=Kn&&(qn(e)?Wn(e):!!e)},$n=Hn.normalize=function(t){return String(t).replace(Xn,".").toLowerCase()},Jn=Hn.data={},Kn=Hn.NATIVE="N",Yn=Hn.POLYFILL="P",Qn=Hn,to=d,eo=g.f,ro=er,no=an,oo=Nt,io=function(t,e,r){for(var n=Vn(e),o=Un.f,i=Bn.f,s=0;sy;y++)if((a||y in d)&&(h=g(p=d[y],y,m),t))if(e)w[y]=h;else if(h)switch(t){case 3:return!0;case 5:return p;case 6:return y;case 2:Ko(w,p)}else switch(t){case 4:return!1;case 7:Ko(w,p)}return i?-1:n||o?o:w}},Qo={forEach:Yo(0),map:Yo(1),filter:Yo(2),some:Yo(3),every:Yo(4),find:Yo(5),findIndex:Yo(6),filterReject:Yo(7)},ti=v,ei=lt,ri=ae("species"),ni=function(t){return ei>=51||!ti((function(){var e=[];return(e.constructor={})[ri]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},oi=Qo.map;function ii(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o1?arguments[1]:void 0)}});var si=Pt,ai=Vt,ui=W,ci=bn,fi=d.TypeError,li=function(t){return function(e,r,n,o){si(r);var i=ai(e),s=ui(i),a=ci(i),u=t?a-1:0,c=t?-1:1;if(n<2)for(;;){if(u in s){o=s[u],u+=c;break}if(u+=c,t?u<0:a<=u)throw fi("Reduce of empty array with no initial value")}for(;t?u>=0:a>u;u+=c)u in s&&(o=r(o,s[u],u,i));return o}},pi={left:li(!1),right:li(!0)},hi=v,mi=function(t,e){var r=[][t];return!!r&&hi((function(){r.call(null,e||function(){return 1},1)}))},di="process"==Z(d.process),gi=pi.left,vi=lt,yi=di;ao({target:"Array",proto:!0,forced:!mi("reduce")||!yi&&vi>79&&vi<83},{reduce:function(t){var e=arguments.length;return gi(this,t,e,e>1?arguments[1]:void 0)}});var bi=So,wi=mo?{}.toString:function(){return"[object "+bi(this)+"]"};mo||an(Object.prototype,"toString",wi,{unsafe:!0});var ki=Qo.filter;ao({target:"Array",proto:!0,forced:!ni("filter")},{filter:function(t){return ki(this,t,arguments.length>1?arguments[1]:void 0)}});var Oi=function(){function t(r){var n=r.markers,o=r.position;e(this,t),this.markers=n,o&&(o instanceof google.maps.LatLng?this._position=o:this._position=new google.maps.LatLng(o))}return n(t,[{key:"bounds",get:function(){if(0!==this.markers.length||this._position)return this.markers.reduce((function(t,e){return t.extend(e.getPosition())}),new google.maps.LatLngBounds(this._position,this._position))}},{key:"position",get:function(){return this._position||this.bounds.getCenter()}},{key:"count",get:function(){return this.markers.filter((function(t){return t.getVisible()})).length}},{key:"push",value:function(t){this.markers.push(t)}},{key:"delete",value:function(){this.marker&&(this.marker.setMap(null),delete this.marker),this.markers.length=0}}]),t}(),Si=function(t,e,r,n){var o=xi(t.getBounds(),e,n);return r.filter((function(t){return o.contains(t.getPosition())}))},xi=function(t,e,r){var n=Pi(t,e),o=n.northEast,i=n.southWest,s=Ei({northEast:o,southWest:i},r);return ji(s,e)},Mi=function(t,e){var r=(e.lat-t.lat)*Math.PI/180,n=(e.lng-t.lng)*Math.PI/180,o=Math.sin(r/2)*Math.sin(r/2)+Math.cos(t.lat*Math.PI/180)*Math.cos(e.lat*Math.PI/180)*Math.sin(n/2)*Math.sin(n/2);return 6371*(2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)))},Pi=function(t,e){return{northEast:e.fromLatLngToDivPixel(t.getNorthEast()),southWest:e.fromLatLngToDivPixel(t.getSouthWest())}},Ei=function(t,e){var r=t.northEast,n=t.southWest;return r.x+=e,r.y-=e,n.x-=e,n.y+=e,{northEast:r,southWest:n}},ji=function(t,e){var r=t.northEast,n=t.southWest,o=new google.maps.LatLngBounds;return o.extend(e.fromDivPixelToLatLng(r)),o.extend(e.fromDivPixelToLatLng(n)),o},Ci=function(){function t(r){var n=r.maxZoom,o=void 0===n?16:n;e(this,t),this.maxZoom=o}return n(t,[{key:"noop",value:function(t){var e=t.markers;return Li(e)}}]),t}(),_i=function(t){o(i,t);var r=u(i);function i(t){var n;e(this,i);var o=t.viewportPadding,s=void 0===o?60:o,a=ii(t,["viewportPadding"]);return(n=r.call(this,a)).viewportPadding=60,n.viewportPadding=s,n}return n(i,[{key:"calculate",value:function(t){var e=t.markers,r=t.map,n=t.mapCanvasProjection;return r.getZoom()>=this.maxZoom?{clusters:this.noop({markers:e,map:r,mapCanvasProjection:n}),changed:!1}:{clusters:this.cluster({markers:Si(r,n,e,this.viewportPadding),map:r,mapCanvasProjection:n})}}}]),i}(Ci),Li=function(t){return t.map((function(t){return new Oi({position:t.getPosition(),markers:[t]})}))},Ti=Se("span").classList,Ii=Ti&&Ti.constructor&&Ti.constructor.prototype,Ai=Ii===Object.prototype?void 0:Ii,Ni=Qo.forEach,zi=d,Ri={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Fi=Ai,Zi=mi("forEach")?[].forEach:function(t){return Ni(this,t,arguments.length>1?arguments[1]:void 0)},Di=er,Gi=function(t){if(t&&t.forEach!==Zi)try{Di(t,"forEach",Zi)}catch(e){t.forEach=Zi}};for(var Vi in Ri)Ri[Vi]&&Gi(zi[Vi]&&zi[Vi].prototype);Gi(Fi);var Bi=O;ao({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Bi(URL.prototype.toString,this)}});var Ui=function(t){o(i,t);var r=u(i);function i(t){var n;e(this,i);var o=t.maxDistance,s=void 0===o?4e4:o,a=t.gridSize,u=void 0===a?40:a,c=ii(t,["maxDistance","gridSize"]);return(n=r.call(this,c)).clusters=[],n.maxDistance=s,n.gridSize=u,n}return n(i,[{key:"cluster",value:function(t){var e=this,r=t.markers,n=t.map,o=t.mapCanvasProjection;return this.clusters=[],r.forEach((function(t){e.addToClosestCluster(t,n,o)})),this.clusters}},{key:"addToClosestCluster",value:function(t,e,r){for(var n=this.maxDistance,o=null,i=0;io;)for(var a,u=ns(arguments[o++]),c=i?ss(Qi(u),i(u)):Qi(u),f=c.length,l=0;f>l;)a=c[l++],$i&&!Ki(s,u,a)||(r[a]=u[a]);return r}:os;ao({target:"Object",stat:!0,arity:2,forced:Object.assign!==as},{assign:as});var us={exports:{}};us.exports=function(){function t(r,n,o,i,s,a){if(!(s-i<=o)){var u=i+s>>1;e(r,n,u,i,s,a%2),t(r,n,o,i,u-1,a+1),t(r,n,o,u+1,s,a+1)}}function e(t,n,o,i,s,a){for(;s>i;){if(s-i>600){var u=s-i+1,c=o-i+1,f=Math.log(u),l=.5*Math.exp(2*f/3),p=.5*Math.sqrt(f*l*(u-l)/u)*(c-u/2<0?-1:1);e(t,n,o,Math.max(i,Math.floor(o-c*l/u+p)),Math.min(s,Math.floor(o+(u-c)*l/u+p)),a)}var h=n[2*o+a],m=i,d=s;for(r(t,n,i,o),n[2*s+a]>h&&r(t,n,i,s);mh;)d--}n[2*i+a]===h?r(t,n,i,d):r(t,n,++d,s),d<=o&&(i=d+1),o<=d&&(s=d-1)}}function r(t,e,r,o){n(t,r,o),n(e,2*r,2*o),n(e,2*r+1,2*o+1)}function n(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function o(t,e,r,n,o,i,s){for(var a,u,c=[0,t.length-1,0],f=[];c.length;){var l=c.pop(),p=c.pop(),h=c.pop();if(p-h<=s)for(var m=h;m<=p;m++)a=e[2*m],u=e[2*m+1],a>=r&&a<=o&&u>=n&&u<=i&&f.push(t[m]);else{var d=Math.floor((h+p)/2);a=e[2*d],u=e[2*d+1],a>=r&&a<=o&&u>=n&&u<=i&&f.push(t[d]);var g=(l+1)%2;(0===l?r<=a:n<=u)&&(c.push(h),c.push(d-1),c.push(g)),(0===l?o>=a:i>=u)&&(c.push(d+1),c.push(p),c.push(g))}}return f}function i(t,e,r,n,o,i){for(var a=[0,t.length-1,0],u=[],c=o*o;a.length;){var f=a.pop(),l=a.pop(),p=a.pop();if(l-p<=i)for(var h=p;h<=l;h++)s(e[2*h],e[2*h+1],r,n)<=c&&u.push(t[h]);else{var m=Math.floor((p+l)/2),d=e[2*m],g=e[2*m+1];s(d,g,r,n)<=c&&u.push(t[m]);var v=(f+1)%2;(0===f?r-o<=d:n-o<=g)&&(a.push(p),a.push(m-1),a.push(v)),(0===f?r+o>=d:n+o>=g)&&(a.push(m+1),a.push(l),a.push(v))}}return u}function s(t,e,r,n){var o=t-r,i=e-n;return o*o+i*i}var a=function(t){return t[0]},u=function(t){return t[1]},c=function(e,r,n,o,i){void 0===r&&(r=a),void 0===n&&(n=u),void 0===o&&(o=64),void 0===i&&(i=Float64Array),this.nodeSize=o,this.points=e;for(var s=e.length<65536?Uint16Array:Uint32Array,c=this.ids=new s(e.length),f=this.coords=new i(2*e.length),l=0;lt},ls=Math.fround||(ps=new Float32Array(1),t=>(ps[0]=+t,ps[0]));var ps;class hs{constructor(t){this.options=ks(Object.create(fs),t),this.trees=new Array(this.options.maxZoom+1)}load(t){const{log:e,minZoom:r,maxZoom:n,nodeSize:o}=this.options;e&&console.time("total time");const i=`prepare ${t.length} points`;e&&console.time(i),this.points=t;let s=[];for(let e=0;e=r;t--){const r=+Date.now();s=this._cluster(s,t),this.trees[t]=new cs(s,Os,Ss,o,Float32Array),e&&console.log("z%d: %d clusters in %dms",t,s.length,+Date.now()-r)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let o=180===t[2]?180:((t[2]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,o=180;else if(r>o){const t=this.getClusters([r,n,180,i],e),s=this.getClusters([-180,n,o,i],e);return t.concat(s)}const s=this.trees[this._limitZoom(e)],a=s.range(ys(r),bs(i),ys(o),bs(n)),u=[];for(const t of a){const e=s.points[t];u.push(e.numPoints?gs(e):this.points[e.index])}return u}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",o=this.trees[r];if(!o)throw new Error(n);const i=o.points[e];if(!i)throw new Error(n);const s=this.options.radius/(this.options.extent*Math.pow(2,r-1)),a=o.within(i.x,i.y,s),u=[];for(const e of a){const r=o.points[e];r.parentId===t&&u.push(r.numPoints?gs(r):this.points[r.index])}if(0===u.length)throw new Error(n);return u}getLeaves(t,e,r){e=e||10,r=r||0;const n=[];return this._appendLeaves(n,t,e,r,0),n}getTile(t,e,r){const n=this.trees[this._limitZoom(t)],o=Math.pow(2,t),{extent:i,radius:s}=this.options,a=s/i,u=(r-a)/o,c=(r+1+a)/o,f={features:[]};return this._addTileFeatures(n.range((e-a)/o,u,(e+1+a)/o,c),n.points,e,r,o,f),0===e&&this._addTileFeatures(n.range(1-a/o,u,1,c),n.points,o,r,o,f),e===o-1&&this._addTileFeatures(n.range(0,u,a/o,c),n.points,-1,r,o,f),f.features.length?f:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,n,o){const i=this.getChildren(e);for(const e of i){const i=e.properties;if(i&&i.cluster?o+i.point_count<=n?o+=i.point_count:o=this._appendLeaves(t,i.cluster_id,r,n,o):oe&&(l+=r.numPoints||1)}if(l>f&&l>=s){let t=o.x*f,s=o.y*f,a=i&&f>1?this._map(o,!0):null;const p=(n<<5)+(e+1)+this.points.length;for(const r of c){const n=u.points[r];if(n.zoom<=e)continue;n.zoom=e;const c=n.numPoints||1;t+=n.x*c,s+=n.y*c,n.parentId=p,i&&(a||(a=this._map(o,!0)),i(a,this._map(n)))}o.parentId=p,r.push(ms(t/l,s/l,p,l,a))}else if(r.push(o),l>1)for(const t of c){const n=u.points[t];n.zoom<=e||(n.zoom=e,r.push(n))}}return r}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e){if(t.numPoints)return e?ks({},t.properties):t.properties;const r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?ks({},n):n}}function ms(t,e,r,n,o){return{x:ls(t),y:ls(e),zoom:1/0,id:r,parentId:-1,numPoints:n,properties:o}}function ds(t,e){const[r,n]=t.geometry.coordinates;return{x:ls(ys(r)),y:ls(bs(n)),zoom:1/0,index:e,parentId:-1}}function gs(t){return{type:"Feature",id:t.id,properties:vs(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),ws(t.y)]}};var e}function vs(t){const e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return ks(ks({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function ys(t){return t/360+.5}function bs(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function ws(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function ks(t,e){for(const r in e)t[r]=e[r];return t}function Os(t){return t.x}function Ss(t){return t.y}var xs=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if((n=e.length)!=r.length)return!1;for(o=n;0!=o--;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((n=(i=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;0!=o--;){var s=i[o];if(!t(e[s],r[s]))return!1}return!0}return e!=e&&r!=r},Ms=function(t){o(i,t);var r=u(i);function i(t){var n;e(this,i);var o=t.maxZoom,s=t.radius,a=void 0===s?60:s,u=ii(t,["maxZoom","radius"]);return(n=r.call(this,{maxZoom:o})).superCluster=new hs(Object.assign({maxZoom:n.maxZoom,radius:a},u)),n.state={zoom:null},n}return n(i,[{key:"calculate",value:function(t){var e=!1;if(!xs(t.markers,this.markers)){e=!0,this.markers=f(t.markers);var r=this.markers.map((function(t){return{type:"Feature",geometry:{type:"Point",coordinates:[t.getPosition().lng(),t.getPosition().lat()]},properties:{marker:t}}}));this.superCluster.load(r)}var n={zoom:t.map.getZoom()};return e||this.state.zoom>this.maxZoom&&n.zoom>this.maxZoom||(e=e||!xs(this.state,n)),this.state=n,e&&(this.clusters=this.cluster(t)),{clusters:this.clusters,changed:e}}},{key:"cluster",value:function(t){var e=t.map;return this.superCluster.getClusters([-180,-90,180,90],Math.round(e.getZoom())).map(this.transformCluster.bind(this))}},{key:"transformCluster",value:function(t){var e=c(t.geometry.coordinates,2),r=e[0],n=e[1],o=t.properties;if(o.cluster)return new Oi({markers:this.superCluster.getLeaves(o.cluster_id,1/0).map((function(t){return t.properties.marker})),position:new google.maps.LatLng({lat:n,lng:r})});var i=o.marker;return new Oi({markers:[i],position:i.getPosition()})}}]),i}(Ci),Ps={},Es=y,js=ze,Cs=Ne,_s=Ge,Ls=J,Ts=Hi;Ps.f=Es&&!js?Object.defineProperties:function(t,e){_s(t);for(var r,n=Ls(e),o=Ts(e),i=o.length,s=0;i>s;)Cs.f(t,r=o[s++],n[r]);return t};var Is,As=nt("document","documentElement"),Ns=Ge,zs=Ps,Rs=Ln,Fs=xr,Zs=As,Ds=Se,Gs=Sr("IE_PROTO"),Vs=function(){},Bs=function(t){return"
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Enumeration MarkerClustererEvents

    Index

    Enumeration members

    CLUSTERING_BEGIN = "clusteringbegin"
    CLUSTERING_END = "clusteringend"
    CLUSTER_CLICK = "click"

    Legend

    • Constructor
    • Property
    • Method
    • Property
    • Method
    • Protected property
    • Protected method
    • Inherited method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +MarkerClustererEvents | @googlemaps/js-markerclusterer
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Enumeration MarkerClustererEvents

    Index

    Enumeration members

    CLUSTERING_BEGIN = "clusteringbegin"
    CLUSTERING_END = "clusteringend"
    CLUSTER_CLICK = "click"

    Legend

    • Constructor
    • Property
    • Method
    • Property
    • Method
    • Protected property
    • Protected method
    • Inherited method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/Algorithm.html b/interfaces/Algorithm.html index 82e89317..306fc788 100644 --- a/interfaces/Algorithm.html +++ b/interfaces/Algorithm.html @@ -1,3 +1,3 @@ -Algorithm | @googlemaps/js-markerclusterer
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • Algorithm

    Index

    Methods

    Methods