Skip to content

Rectangle (gm-rectangle)


In addition to polylines, polygons, and circles you can also create rectangles on a map.

Simple Use (demo)

html
<template>
  <div style="height: 500px">
    <gm-map>
      <gm-rectangle :bounds="{ east: 145, north: -20, west: 132, south: -27 }" />
    </gm-map>
  </div>
</template>

<script setup lang="ts">
import { gmMap, gmRectangle } from 'v3-gmaps';
</script>

Props

PropsTypeDefaultDescription
boundsGmBounds-The bounds.
draggablebooleanfalseWhether this Rectangle can be dragged over the map.
editablebooleanfalseWhether this Rectangle can be edited by dragging the control points shown at the corners and on each edge.
visiblebooleantrueWhether this rectangle is visible on the map.
optionsgoogle.maps.RectangleOptions-Google Maps RectangleOptions interface

Events

EventTypeDescription
bounds_changedGmBoundsThis event is fired when the rectangle's bounds are changed.
clickGmPositionThis event is fired when the DOM click event is fired on the rectangle.
contextmenuGmPositionThis event is fired when the DOM contextmenu event is fired on the rectangle.
dblclickGmPositionThis event is fired when the DOM dblclick event is fired on the rectangle.
dragGmPositionThis event is repeatedly fired while the user drags the Rectangle.
dragendGmPositionThis event is fired when the user stops dragging the Rectangle.
dragstartGmPositionThis event is fired when the user starts dragging the Rectangle.
mountedgoogle.maps.RectangleOn mounted the component will emit the Google Maps object it represents.
mousedownGmPositionThis event is fired for a mousedown on the Rectangle.
mousemoveGmPositionThis event is fired for a mousemove on the Rectangle.
mouseoutGmPositionThis event is fired when the mouse leaves the area of the Rectangle.
mouseoverGmPositionThis event is fired when the mouse enters the area of the Rectangle.
mouseupGmPositionThis event is fired for a mouseup on the Rectangle.
rightclickGmPositionThis event is fired for a rightclick on the Rectangle.
unmountedgoogle.maps.RectangleOn unmounted the component will emit the Google Maps object it represents.

Released under the MIT License.