'use strict' ; import type { GeoJSONGeometryMultiPoint } from '../../Maps/GeoJSON' ; import type MapPointOptions from './MapPointOptions' ; import type MapSeries from './MapSeries' ; import type { MapBounds } from '../../Maps/MapViewOptions' ; import type PointerEvent from '../../Core/PointerEvent' ; import type { PointShortOptions } from '../../Core/Series/PointOptions' ; import type Projection from '../../Maps/Projection' ; import type SVGElement from '../../Core/Renderer/SVG/SVGElement.js' ; import type SVGPath from '../../Core/Renderer/SVG/SVGPath' ; import ColorMapMixin from '../ColorMapMixin.js' ; import MapUtilities from '../../Maps/MapUtilities.js' ; const { boundsFromPath } = MapUtilities ; import SeriesRegistry from '../../Core/Series/SeriesRegistry.js' ; const { seriesTypes : { scatter : ScatterSeries } } = SeriesRegistry ; import U from '../../Core/Utilities.js' ; const { extend , isNumber , pick } = U ; class MapPoint extends ScatterSeries . prototype . pointClass { public colorInterval ? : unknown ; public geometry ? : GeoJSONGeometryMultiPoint ; public group ? : SVGElement ; public insetIndex ? : number ; public labelrank ? : number ; public options : MapPointOptions = void 0 as any ; public path : SVGPath = void 0 as any ; public projectedPath : SVGPath | undefined ; public series : MapSeries = void 0 as any ; public static getProjectedPath ( point , projection ? ) { if ( ! point . projectedPath ) { if ( projection && point . geometry ) { projection . hasCoordinates = true ; point . projectedPath = projection . path ( point . geometry ) ; } else { point . projectedPath = point . path ; } } return point . projectedPath || [ ] ; } private public applyOptions ( options , x ? ) { let series = this . series , point = ( super . applyOptions . call ( this , options , x ) as any ) , joinBy = series . joinBy , mapPoint ; if ( series . mapData && series . mapMap ) { const joinKey = joinBy [ 1 ] ; const mapKey = super . getNestedProperty . call ( point , joinKey ) as string ; mapPoint = typeof mapKey !== 'undefined' && series . mapMap [ mapKey ] ; if ( mapPoint ) { extend ( point , mapPoint ) ; } else { point . value = point . value || null ; } } return point ; } public getProjectedBounds ( projection ) { const path = MapPoint . getProjectedPath ( this , projection ) , bounds = boundsFromPath ( path ) , properties = this . properties ; if ( bounds ) { const propMiddleX = properties && properties [ 'hc-middle-x' ] , propMiddleY = properties && properties [ 'hc-middle-y' ] ; bounds . midX = ( bounds . x1 + ( bounds . x2 - bounds . x1 ) * pick ( this . middleX , isNumber ( propMiddleX ) ? propMiddleX : 0.5 ) ) ; let middleYFraction = pick ( this . middleY , isNumber ( propMiddleY ) ? propMiddleY : 0.5 ) ; if ( ! this . geometry ) { middleYFraction = 1 - middleYFraction ; } bounds . midY = bounds . y2 - ( bounds . y2 - bounds . y1 ) * middleYFraction ; return bounds ; } } private public onMouseOver ( e ? ) { U . clearTimeout ( this . colorInterval as any ) ; if ( this . value !== null || this . series . options . nullInteraction ) { super . onMouseOver . call ( this , e ) ; } else { ( this . series . onMouseOut as any ) ( e ) ; } } sample requires function public zoomTo ( ) { const point = this as ( MapPoint & MapPoint . CacheObject ) ; const chart = point . series . chart ; if ( chart . mapView && point . bounds ) { chart . mapView . fitToBounds ( point . bounds , void 0 , false ) ; point . series . isDirty = true ; chart . redraw ( ) ; } } } interface MapPoint { bounds ? : MapBounds ; dataLabelOnNull : ColorMapMixin . ColorMapPoint [ 'dataLabelOnNull' ] ; isValid : ColorMapMixin . ColorMapPoint [ 'isValid' ] ; middleX ? : number ; middleY ? : number ; moveToTopOnHover : ColorMapMixin . ColorMapPoint [ 'moveToTopOnHover' ] ; properties ? : Record < string , ( number | string ) > ; value : ColorMapMixin . ColorMapPoint [ 'value' ] ; } extend ( MapPoint . prototype , { dataLabelOnNull : ColorMapMixin . PointMixin . dataLabelOnNull , isValid : ColorMapMixin . PointMixin . isValid , moveToTopOnHover : ColorMapMixin . PointMixin . moveToTopOnHover } ) ; namespace MapPoint { export interface CacheObject { bounds ? : MapBounds ; } } export default MapPoint ;