1/**
2 * Sample plugin.
3 */
4Draw.loadPlugin(function(ui) {
5
6	var graph = ui.editor.graph;
7
8	function updateOverlays(cell)
9	{
10		var tooltip = cell.getAttribute('tooltip');
11
12		if (tooltip != null && tooltip.length > 0)
13		{
14			var overlays = graph.getCellOverlays(cell);
15
16			if (overlays == null)
17			{
18				// Creates a new overlay with an image
19				var overlay = new mxCellOverlay(
20					new mxImage('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAJGUlEQVR42u1ZCXAT1xn+38qWkGVL8iXbWNjGNhiDiQl13KFMuVqImbRpQ+iEpiVt2lyTtmkLYShJmzadkEmPaWiT4hDaaUNnGujBMSHU9ZQESDldsAEbgw3G8i350n2sVvv6v9VhCUuy8RjszGTH67fa/fft9/3v+//3v10CH/ONTDWATwhMNYDpQYAQqSupGbNLCpT628DBFBAgHIJFwIly0BSWgSZ/HlHlFoEqOw8UmnQi12QQwnFJaCkP3MHj7vQMmyhvM1OHsQMc3W1gNVyl5huXQPS4kUuQ0O2RGj8BBhiBJ+uLIWfJWqJbvALSSiu0nHxGJV75FPa0AI2KsdVjm453JATQBJ8h4M9BPNOF7XVsm3Aszote/py5tcFsunAMes/UUGtbE/IQxz06YxNA0DK5AvQrHob8qq+R1JKKfCLjvoJXvoiE7gt4mT2NC9xBY/Qbfj4cHY+A67B9j4ri3603Gg2G2r/Sjv/sBcHlQEtxggTQ41yiAmZ/4XEoXv9dboZWV4XAv4cXVuFV2S33TkiKTIaUhlzNWh82H1Cf+AbvMNfcOPi22La/GgS3I+aIRH8wx0Hmvcth4dOvEpTMGtTzdjx7L3siie3hSdnoSJTX48i86DJ11zb94SXac/IwgDh6NMitP5nXSx//Mcx+8IlsjpP9DkGvY+K/2/nWn6ikYNiP0nqu8+jf+hrfegFlZY8YjRFc6Ft5Shos3voWyVy0bCVwsr/gxayAjT9HTkLai/TXmH1KaQn/GUH0bTS3Xvyw7pVvUvdgb+g+EuSRmKKFJdv/QdRFZY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+/9BpNFwwN53zDdYfQ2l0T+hb1x0hoMjIgfwHn2If89Tg/+YlUJzQvfZh6hkygqvXAI6uFv/MeBuBd9cI+C1ive+aPB3fWQLTfPuEwFRvH3sC/weRVVoCD7mx+AAAAABJRU5ErkJggg==', 48, 48),
21					null, mxConstants.ALIGN_RIGHT, mxConstants.ALIGN_TOP, null, 'default');
22
23				// Sets the overlay for the cell in the graph
24				graph.addCellOverlay(cell, overlay);
25			}
26		}
27		else
28		{
29			graph.removeCellOverlays(cell);
30		}
31	};
32
33	function refresh()
34	{
35		var cells = graph.model.cells;
36
37		for (var id in cells)
38		{
39			updateOverlays(cells[id]);
40		}
41	};
42
43	graph.addListener(mxEvent.SIZE, refresh);
44	refresh();
45});