highlightByIndices()

in packages/layers/geojson/src/Polygon/PolygonLayer.ts [99:133]


	highlightByIndices(dataIndexArr: number[], style: { type: 'none' | 'select' | 'hover' }) {
		const data = this.getProp('data')

		if (!data || !Array.isArray(data.features)) return
		if (!style || !style.type) return

		dataIndexArr.forEach((index) => {
			const feature = data.features[index]
			if (!feature) return

			// Restore last highlight styles
			this._restoreFeatureColor(feature)
			this._restoreHoverLines(feature)
			this._restoreSelectLines(feature)

			switch (style.type) {
				case 'none':
					break
				case 'select':
					this._updateSelectLines(feature)
					if (this.selectColor) {
						this._updateFeatureColor(feature, this.selectColor)
					}
					break
				case 'hover':
					this._updateHoverLines(feature)
					if (this.hoverColor) {
						this._updateFeatureColor(feature, this.hoverColor)
					}
					break
				default:
					console.error(`Polaris::PolygonLayer - Invalid style.type param: ${style}`)
			}
		})
	}