blob: 0b5eac8d1a4a5f0678cb069ed6f1de8f950925e0 [file] [log] [blame]
Simon Hunt72e44bf2015-07-21 21:34:20 -07001// sample topology overlay - client side
2(function () {
3 'use strict';
4
5 // injected refs
6 var $log;
7
8 // our overlay definition
9 var overlay = {
Simon Huntfb940112015-07-29 18:36:35 -070010 // NOTE: this must match the ID defined in AppUiTopoOverlay
11 overlayId: 'meowster-overlay',
12 glyphId: '*star4',
13 tooltip: 'Sample Meowster Topo Overlay',
Simon Hunt72e44bf2015-07-21 21:34:20 -070014
Simon Huntfb940112015-07-29 18:36:35 -070015 // These glyphs get installed using the overlayId as a prefix.
16 // e.g. 'star4' is installed as 'meowster-overlay-star4'
17 // They can be referenced (from this overlay) as '*star4'
18 // That is, the '*' prefix stands in for 'meowster-overlay-'
19 glyphs: {
20 star4: {
21 vb: '0 0 8 8',
22 d: 'M1,4l2,-1l1,-2l1,2l2,1l-2,1l-1,2l-1,-2z'
23 },
24 banner: {
25 vb: '0 0 6 6',
26 d: 'M1,1v4l2,-2l2,2v-4z'
27 }
Simon Hunt72e44bf2015-07-21 21:34:20 -070028 },
Simon Hunt72e44bf2015-07-21 21:34:20 -070029
30 activate: activateOverlay,
Simon Huntfb940112015-07-29 18:36:35 -070031 deactivate: deactivateOverlay,
32
Simon Hunt01106b92015-08-04 20:14:53 -070033 // button callbacks matching button identifiers
34 buttonActions: {
35 foo: fooCb,
36 bar: barCb
Simon Huntfb940112015-07-29 18:36:35 -070037 }
Simon Hunt72e44bf2015-07-21 21:34:20 -070038 };
39
Simon Huntfb940112015-07-29 18:36:35 -070040 function fooCb(data) {
41 $log.debug('FOO callback with data:', data);
42 }
43
44 function barCb(data) {
45 $log.debug('BAR callback with data:', data);
46 }
47
Simon Hunt72e44bf2015-07-21 21:34:20 -070048 // === implementation of overlay API (essentially callbacks)
49 function activateOverlay() {
50 $log.debug("sample topology overlay ACTIVATED");
51 }
52
53 function deactivateOverlay() {
54 $log.debug("sample topology overlay DEACTIVATED");
55 }
56
57
58 // invoke code to register with the overlay service
59 angular.module('ovSample')
60 .run(['$log', 'TopoOverlayService',
61
62 function (_$log_, tov) {
63 $log = _$log_;
64 tov.register(overlay);
65 }]);
66
67}());