Commit 87a2dba730b7217f174636c130bf062947579246

Authored by Igor Kulikov
1 parent 86018bba

UI: Image Map - fix tooltip actions.

... ... @@ -26,8 +26,9 @@ const pinSvg = `<svg class="image-map-pin-image" xmlns="http://www.w3.org/2000/s
26 26
27 27 export default class TbImageMap {
28 28
29   - constructor($containerElement, initCallback, imageUrl, posFunction) {
  29 + constructor(ctx, $containerElement, initCallback, imageUrl, posFunction) {
30 30
  31 + this.ctx = ctx;
31 32 this.tooltips = [];
32 33
33 34 $containerElement.append('<div id="image-map-container"><div id="image-map"></div></div>');
... ... @@ -195,7 +196,7 @@ export default class TbImageMap {
195 196 }
196 197
197 198 createTooltip(marker, pattern, replaceInfo, markerArgs) {
198   - var popup = new Popup(marker.pinElement);
  199 + var popup = new Popup(this.ctx, marker.pinElement);
199 200 popup.setContent('');
200 201 this.tooltips.push( {
201 202 markerArgs: markerArgs,
... ... @@ -271,7 +272,7 @@ class Position {
271 272 }
272 273
273 274 class Popup {
274   - constructor(anchor) {
  275 + constructor(ctx, anchor) {
275 276 anchor.tooltipster(
276 277 {
277 278 theme: 'tooltipster-shadow',
... ... @@ -287,9 +288,11 @@ class Popup {
287 288 this.tooltip = anchor.tooltipster('instance');
288 289 var contentElement = angular.element('<div class="image-map-pin-tooltip">' +
289 290 '<a class="image-map-pin-tooltip-close-button" id="close" style="outline: none;">×</a>' +
290   - '<div flex id="tooltip-content" layout="column">' +
  291 + '<div id="tooltip-content">' +
291 292 '</div>' +
292 293 '</div>');
  294 + var $compile = ctx.$scope.$injector.get('$compile');
  295 + $compile(contentElement)(ctx.$scope);
293 296 var popup = this;
294 297 contentElement.find('#close').on('click', function() {
295 298 popup.tooltip.close();
... ...
... ... @@ -79,7 +79,7 @@ export default class TbMapWidgetV2 {
79 79 } else if (mapProvider === 'openstreet-map') {
80 80 this.map = new TbOpenStreetMap($element, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, minZoomLevel);
81 81 } else if (mapProvider === 'image-map') {
82   - this.map = new TbImageMap($element, initCallback, settings.mapImageUrl, settings.posFunction);
  82 + this.map = new TbImageMap(this.ctx, $element, initCallback, settings.mapImageUrl, settings.posFunction);
83 83 }
84 84 }
85 85
... ...