Skip to content

MigrationLayer

Example

Example Source Code
vue
<template>
  <div class="map-container">
    <mb-map :pitch="60" :bearing="30" :zoom="3.5">
      <mb-tianditu-layer :types="['img']" />
      <mb-arc-layer
        :data="data"
        :source-position="sourcePosition"
        :target-position="targetPosition"
        :width="3"
        :height="0.8"
        :source-color="sourceColor"
        :target-color="targetColor"
      />
      <mb-migration-layer
        :data="data"
        :source-position="sourcePosition"
        :target-position="targetPosition"
        :width="3"
        :height="0.8"
        source-color="#fff"
        target-color="#fff"
        :trail-length="5"
      />
    </mb-map>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'

const data = ref<{ to: [number, number] }[]>([])
const sourcePosition = [116, 39]
const targetPosition = (d) => d.to
const sourceColor = 'rgb(255, 0, 128)'
const targetColor = 'rgb(0, 200, 255)'

function getRandomArbitrary(min: number, max: number) {
  return Math.random() * (max - min) + min
}

onMounted(() => {
  for (let i = 0; i < 100; i++) {
    data.value.push({
      to: [getRandomArbitrary(100, 132), getRandomArbitrary(25, 50)],
    })
  }
})
</script>

API

PROPS

NameDescriptionTypeDefault
idLayer IDstring-
trail-lengthLength of the trail (e.g., in number of segments, time units, or distance).number5
dataSource data for the layer.string / IndexAny / AnyArr / Promise<any>''
showWhether the layer is visible.booleantrue
opacityThe opacity of the layer (0-1).number1
pickableWhether the layer responds to mouse events. If false, the component will not emit mouse-related events.booleanfalse
auto-highlightWhen this property is true and pickable is also true, the hovered object will be highlighted.booleanfalse
highlight-colorThe color to blend with the original color of the highlighted object.string / number[][255, 255, 128, 1]
highlighted-object-indexThe index of the currently highlighted element.number-1
on-data-loadCallback function invoked after data loading is complete.AnyFunc-
data-transformFunction to transform the data before rendering.AnyFunc-
transitionsTransition settings for the layer.IndexAny{}
source-positionSource position.AnyArr / AnyFunc-
target-positionTarget position.AnyArr / AnyFunc-
source-colorSource color.string / AnyFunc'black'
target-colorTarget color.string / AnyFunc'black'
widthWidth.number / AnyNumberFunc1

EVENTS

NameDescriptionParameters

SLOTS

NameDescription

METHODS

NameDescriptionDefinition