Skip to content

Can't drag or transform polygon in Vue 3 project #99

@rizypb

Description

@rizypb
  • Can’t drag or transform polygon in Vue 3 project
  • Computer
    • MacOS BigSur 11.6.1
    • Ram 8 GB
  • Version
    • vue: 3.2.41
    • leaflet: 1.7.1
    • leaflet-path-transform: 1.1.1

Code

import L from 'leaflet';
import 'leaflet-path-transform';
import 'leaflet/dist/leaflet.css';

const map = L.map('map').setView([0, 0], 2);
  L.tileLayer('https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', {
    attribution:
      '&copy; <a target="_blank" href="http://osm.org/copyright">OpenStreetMap</a> contributors'
  }).addTo(map);

  const poly1 = [
    [
      [-25, -35],
      [-25, 35],
      [25, 35],
      [25, -35]
    ]
  ];

  const polygon = new L.Polygon([poly1], {
    draggable: true,
    transform: true
  }).addTo(map);

  polygon.transform.setOptions({ rotation: false, scaling: true }).enable();

Transform

Screen Shot 2565-11-10 at 10 47 23

Screen Shot 2565-11-10 at 10 47 32

Drag

Screen Shot 2565-11-10 at 10 49 16

Screen Shot 2565-11-10 at 10 49 22

What's the fix for this? Any help would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions