forked from bhollis/aruco-marker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ng-aruco-marker.js
36 lines (36 loc) · 991 Bytes
/
ng-aruco-marker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// AngularJS Directive for Aruco marker images
// Usage:
// <aruco-marker marker-id="{{markerId}}" size="500px"/>
(function (root, factory) {
if (typeof module !== 'undefined' && module.exports) {
// CommonJS
if (typeof angular === 'undefined') {
factory(require('angular'));
} else {
factory(angular);
}
module.exports = 'ngDialog';
} else if (typeof define === 'function' && define.amd) {
// AMD
define(['angular'], factory);
} else {
// Global Variables
factory(root.angular);
}
}(this, function (angular) {
angular.module('arucoMarker', []).directive('arucoMarker', function() {
return {
restrict: 'E',
scope: {
markerId: '@',
size: '@'
},
link: function(scope, element, attrs) {
scope.$watch('markerId', function(newVal, oldVal) {
var marker = new ArucoMarker(+scope.markerId);
element.html(marker.toSVG(scope.size));
});
}
};
});
}));