maptalks.js icon indicating copy to clipboard operation
maptalks.js copied to clipboard

GeometryCollection 添加圆形 拖拽报错

Open FEJackFly opened this issue 3 years ago • 0 comments

maptalks's version and what browser you use?

Issue description

Please provide a reproduction URL (on any jsfiddle like site)

`<!--

  • @Author: luofei [email protected]
  • @Date: 2022-08-10 16:30:01
  • @LastEditors: luofei [email protected]
  • @LastEditTime: 2022-08-10 18:01:08
  • @FilePath: /MapSet/demo.html
  • @Description:
  • Copyright (c) 2022 by 北京主线科技有限公司京ICP备19025226号-1, All Rights Reserved. -->
图形 - GeometryCollection
<script src="https://turfjs.fenxianglu.cn/turf.min.js"></script>
<body>
    <div id="map" class="container"></div>

    <script>
        var c = new maptalks.Coordinate(-0.113049, 51.498568);
        var map = new maptalks.Map("map", {
            center: c,
            zoom: 14,
            baseLayer: new maptalks.TileLayer("base", {
                urlTemplate:
                    "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
                subdomains: ["a", "b", "c", "d"],
                attribution:
                    '&copy; <a href="http://osm.org">OpenStreetMap</a> contributors, &copy; <a href="https://carto.com/">CARTO</a>',
            }),
        });

        var marker = new maptalks.Marker(c.add(-0.018, 0.007), {
            symbol: {
                textFaceName: "sans-serif",
                textName: "MapTalks",
                textFill: "#34495e",
                textHorizontalAlignment: "right",
                textSize: 40,
            },
        });
        var line = new maptalks.LineString(
            [c.add(-0.018, 0.005), c.add(0.006, 0.005)],
            {
                symbol: {
                    lineColor: "#1bbc9b",
                    lineWidth: 3,
                },
            }
        );
        var polygon = new maptalks.Polygon(
            [
                c.add(-0.018, 0.004),
                c.add(0.006, 0.004),
                c.add(0.006, -0.001),
                c.add(-0.018, -0.001),
                c.add(-0.018, 0.004),
            ],
            {
                symbol: {
                    lineColor: "#34495e",
                    lineWidth: 2,
                    polygonFill: "rgb(135,196,240)",
                    polygonOpacity: 0.6,
                },
            }
        );

        var circle = new maptalks.Circle(c.add(-0.018, 0.004), 100, {
            symbol: {
                lineColor: "#34495e",
                lineWidth: 2,
                polygonFill: "#1bbc9b",
                polygonOpacity: 0.4,
            },
        });
        var collection = new maptalks.GeometryCollection([
            marker,
            line,
            polygon,
            circle,
        ]);

        const layer = new maptalks.VectorLayer("vector", {
            enableSimplify: false,
        }).addTo(map);
        collection.addTo(layer);
        collection.config({
            draggable: true,
        });
    </script>
</body>
`

FEJackFly avatar Aug 10 '22 10:08 FEJackFly