AngularJS:使用Two.js的DragAndDropPolygon

时间:2018-03-28 15:36:53

标签: angularjs two.js

我能够在AngularJS应用程序中使用Two.js正确绘制多边形,现在我正试图用鼠标操纵多边形。我创建了这个功能,但它没有用,任何人都可以帮我找出原因吗?

$scope.DragAndDrop = function (shape) {
       $scope._Drag = function (event) {
            var x = event.ClientX - offset.x;
            var y = event.ClientY - offset.y;
            shape.translation.set(x, y);
       };

       $scope._DragEnd = function (event) {
           $window.unbind('mousemove', drag)
                .unbind('mouseup', dragEnd);
       }
        shape.bind('mousedown', function (event) {
            $window.bind('mousemouve', $scope._Drag)
            .bind('mouseup', $scope._DragEnd);
        });
    }   


 var polygon = two.makePath([new Two.Anchor(jsonPoly.P1.x/3, jsonPoly.P1.y/3)
                                         , new Two.Anchor(jsonPoly.P2.x/3, jsonPoly.P2.y/3)
                                         , new Two.Anchor(jsonPoly.P3.x/3, jsonPoly.P3.y/3)
                                         , new Two.Anchor(jsonPoly.P4.x/3, jsonPoly.P4.y/3)])


            polygon.fill = "#008bbe";
            polygon.opacity = 1;
            polygon.stroke = "#00435c";
            polygon.linewidth = 10;

0 个答案:

没有答案