Skip to content

BufferSectorLayer

Supports drag-and-drop to change position, drag-and-drop to resize, real-time radius display, and other features.

Example

Example Source Code
vue
<template>
  <div style="height: 400px" class="vw-full vh-full">
    <mb-map
      :zoom="10"
      :center="center"
      :glyphs="__RESOURCE_URL__ + 'fonts/{fontstack}/{range}.pbf'"
    >
      <mb-tianditu-layer />
      <mb-buffer-sector-layer
        :center="center"
        :radius="radius"
        border-color="red"
        :border-opacity="0.5"
        background-color="red"
        center-color="red"
        resizer-color="blue"
        :background-opacity="0.1"
        :start-angle="315"
        :closable="true"
        :countable="true"
        :draggable="true"
        :resizable="true"
        :rotatable="true"
      />
    </mb-map>
  </div>
</template>
<script setup lang="ts">
const center = [116.17381, 39.92155464]
const radius = 10
</script>

API

PROPS

NameDescriptionTypeDefault
idLayer IDstring-
centerBuffer center pointnumber[]-
radiusBuffer radius, in kilometersnumber10
start-angleStart angle, with 0 degrees at North from the center, rotating clockwise. Between 0 and 360number0
end-angleEnd angle, with 0 degrees at North from the center, rotating clockwise. Between 0 and 360number90
border-colorBorder colorstringblue
border-opacityBorder opacitynumber0.5
border-widthBorder widthnumber5
background-colorBackground colorstringblue
background-opacityBackground opacitynumber0.1
resizer-colorResizer icon colorstringblack
center-colorCenter point icon colorstringred
closableWhether to display the close iconbooleanfalse
countableWhether to display the radius value as text. You need to load Mapbox font filesbooleanfalse
resizableWhether to display the resizer iconbooleanfalse
draggableWhether the buffer is draggablebooleanfalse
rotatableWhether the buffer is rotatablebooleanfalse
visibleWhether to display the bufferbooleantrue
resizer-radiusResizer icon circle radiusnumber8
center-radiusCenter point icon circle radiusnumber8
text-fontsFont settings for countable textstring[]['Open Sans Regular']
text-colorColor of the countable text.string#000000
text-sizeSize of the countable textnumber16
formatterFormatter for the countable textfunction(radius) => string
close-sizeScaling factor for the close iconnumber0.7
close-offsetOffset of the close iconnumber[][70, 0]
close-icon-urlURL of a custom close iconstring-

EVENTS

NameDescriptionParameters
updateTriggered when the buffer is changedParameters:{center,radius,startAngle,endAngle}
closeTriggered when the close operation is clickedMapMouseEvent
mouseenterTriggered when the mouse enters the buffer-
mouseleaveTriggered when the mouse leaves the buffer-

SLOTS

NameDescription

METHODS

NameDescriptionDefinition