Commit 84b28320b57ead462230139f504157f1a977ad39
1 parent
8c101bb4
changed the implementation of pin drawing. Now using jcanvas to draw the pins on image.
Showing
2 changed files
with
48 additions
and
50 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -3699,41 +3699,54 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic |
3699 | 3699 | }; |
3700 | 3700 | |
3701 | 3701 | |
3702 | - $rootScope.DrawStaticPin = function (canvasId, PinId, offsetX1, offsetY1, x, y) { | |
3702 | + $rootScope.DrawStaticPinsOnImage = function (canvasId, PinId, offsetX1, offsetY1, x, y) { | |
3703 | + | |
3704 | + var radial = $('#' + canvasId).createGradient({ | |
3705 | + x1: 50, y1: 50, | |
3706 | + x2: 50, y2: 50, | |
3707 | + r1: 10, r2: 30, | |
3708 | + c1: 'rgba(100, 50, 0,0)', | |
3709 | + c2: 'rgb(216, 216, 216)' | |
3710 | + }); | |
3711 | + $('#' + canvasId).drawLine({ | |
3712 | + | |
3713 | + layer: true, | |
3714 | + name: "Pin_" + PinId, | |
3715 | + groups: ["Pin_" + PinId], | |
3716 | + strokeStyle: 'black', | |
3717 | + strokeWidth: 2, | |
3718 | + x1: offsetX1, y1: offsetY1, | |
3719 | + x2: x, y2: y, | |
3720 | + | |
3721 | + }).drawArc({ | |
3722 | + name: "ArcPin_" + PinId, | |
3723 | + layer: true, | |
3724 | + groups: ["Pin_" + PinId], | |
3725 | + strokeStyle: 'grey', | |
3726 | + strokeWidth: 2, | |
3727 | + fillStyle: radial, | |
3728 | + x: x, y: y, | |
3729 | + radius: 5, | |
3730 | + | |
3731 | + click: function (clickedPin) { | |
3732 | + | |
3733 | + var radialAfterClick = $('#aaDetailViewCanvas').createGradient({ | |
3734 | + x1: 50, y1: 50, | |
3735 | + x2: 50, y2: 50, | |
3736 | + r1: 10, r2: 30, | |
3737 | + c1: 'rgba(100, 50, 0,0)', | |
3738 | + c2: 'rgb(126, 187, 83)' | |
3739 | + }); | |
3703 | 3740 | |
3741 | + clickedPin.fillStyle = radialAfterClick; | |
3704 | 3742 | |
3705 | - var radial = $('#aaDetailViewCanvas').createGradient({ | |
3706 | - x1: 50, y1: 50, | |
3707 | - x2: 50, y2: 50, | |
3708 | - r1: 10, r2: 30, | |
3709 | - c1: 'rgba(100, 50, 0,0)', | |
3710 | - c2: 'grey' | |
3711 | - }); | |
3712 | - $(canvasId).drawLine({ | |
3713 | - draggable: true, | |
3714 | - layer: true, | |
3715 | - name: "Pin_" + PinId, | |
3716 | - groups: ["Pin_" + PinId], | |
3717 | - dragGroups: ["Pin_" + PinId], | |
3718 | - strokeStyle: 'black', | |
3719 | - strokeWidth: 2, | |
3720 | - x1: offsetX1, y1: offsetY1, | |
3721 | - x2: x, y2: y, | |
3722 | - | |
3723 | - }).drawArc({ | |
3724 | - draggable: true, | |
3725 | - name: "ArcPin_" + PinId, | |
3726 | - // name: "Pin_" + $rootScope.resetPin, | |
3727 | - layer: true, | |
3728 | - groups: ["Pin_" + PinId], | |
3729 | - dragGroups: ["Pin_" + PinId], | |
3730 | - strokeStyle: 'grey', | |
3731 | - strokeWidth: 2, | |
3732 | - fillStyle: radial, | |
3733 | - x: offsetX1, y: offsetY1, | |
3734 | - radius: 5, | |
3743 | + var pinID = (clickedPin.name).substring(7, (clickedPin.name).length); | |
3744 | + // alert('pinId: ' + pinID); | |
3745 | + //showAnnotation(); | |
3735 | 3746 | |
3736 | - }).drawLayers(); | |
3747 | + } | |
3748 | + | |
3749 | + }).drawLayers(); | |
3737 | 3750 | |
3738 | 3751 | } |
3739 | 3752 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
... | ... | @@ -150,7 +150,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
150 | 150 | canvas.style.left = '0px'; |
151 | 151 | canvas.style.top = '0px'; |
152 | 152 | canvas.style.position = "absolute"; |
153 | - canvas.addEventListener('click', aaDetailViewCanvasClickListener); | |
154 | 153 | |
155 | 154 | $("#imageDiv").append(canvas); |
156 | 155 | $scope.context = canvas.getContext("2d") |
... | ... | @@ -236,27 +235,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
236 | 235 | $scope.aaPinData = result.data.Root.Item; |
237 | 236 | angular.forEach($scope.aaPinData, function (value, key) { |
238 | 237 | |
239 | - //$scope.context.beginPath(); | |
240 | - //$scope.context.moveTo(value._PinX, value._PinY); | |
241 | - //$scope.context.lineTo(value._HeadX, value._HeadY); | |
242 | - //$scope.context.stroke(); | |
243 | - | |
244 | - //var headX = (parseInt(value._HeadX)) - 20; | |
245 | - //var headY = (parseInt(value._HeadY)) - 15; | |
246 | - | |
247 | - //var img = new Image(); | |
248 | - //img.src = "~/../../../content/images/noraml-pin.png"; | |
249 | - //img.onload = function () { | |
250 | - // $scope.context.drawImage(img, headX, headY); | |
251 | - //} | |
252 | - $rootScope.DrawStaticPin('aaDetailViewCanvas', value._PinId, value._PinX, value._PinY, value._HeadX, value._HeadY) | |
238 | + $rootScope.DrawStaticPinsOnImage('aaDetailViewCanvas', value._PinId, value._PinX, value._PinY, value._HeadX, value._HeadY, $rootScope.pinID) | |
253 | 239 | }) |
254 | 240 | |
255 | - console.log(JSON.stringify(result, null, 4)); | |
256 | 241 | }, |
257 | 242 | function (error) { |
258 | - // handle errors here | |
259 | - console.log(' error: ' + error.statusText); | |
243 | + | |
244 | + console.log(' error in showAllPins: ' + error.statusText); | |
260 | 245 | } |
261 | 246 | ) |
262 | 247 | } | ... | ... |