UNPKG

ng2-heremaps

Version:
168 lines 5.36 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ import * as tslib_1 from "tslib"; import { Directive, Input, Output, EventEmitter, forwardRef } from '@angular/core'; import { HereMapsManager } from '../services/maps-manager'; import { BaseMapComponent } from './base-map-component'; import { toLatLng } from '../utils/position'; /** * Renders buble on map. Please note that directive must be placed inside * map component, otherwise it will never be rendered. */ var MapBubbleDirective = /** @class */ (function (_super) { tslib_1.__extends(MapBubbleDirective, _super); function MapBubbleDirective(_mapsManager) { var _this = _super.call(this) || this; _this._mapsManager = _mapsManager; /** * This event is fired when the marker icon was clicked. */ _this.click = new EventEmitter(); _this._clickable = true; return _this; } Object.defineProperty(MapBubbleDirective.prototype, "position", { set: /** * Bubble position * @param {?} point * @return {?} */ function (point) { var _this = this; var /** @type {?} */ position = toLatLng(point); this._mapsManager .createBubble({ position: position }) .then(function (bubble) { _this.bindEvents(bubble); _this.proxyResolver(bubble); }); this.proxy.then(function (bubble) { bubble.setPosition(toLatLng(point)); }); }, enumerable: true, configurable: true }); Object.defineProperty(MapBubbleDirective.prototype, "clickable", { set: /** * If true, the marker receives mouse and touch events. * Default value is true. * @param {?} mode * @return {?} */ function (mode) { // this.proxy.then(marker => marker.setClickable(mode)); this._clickable = mode; }, enumerable: true, configurable: true }); Object.defineProperty(MapBubbleDirective.prototype, "contentElement", { set: /** * Rollover text * @param {?} value * @return {?} */ function (value) { this.proxy.then(function (bubble) { return bubble.setContent(value); }); }, enumerable: true, configurable: true }); /** * @return {?} */ MapBubbleDirective.prototype.hasMapComponent = /** * @return {?} */ function () { return !!this.mapComponent; }; /** * @param {?} component * @param {?} map * @param {?} ui * @return {?} */ MapBubbleDirective.prototype.setMapComponent = /** * @param {?} component * @param {?} map * @param {?} ui * @return {?} */ function (component, map, ui) { var _this = this; this.mapComponent = component; this.proxy.then(function (mapObject) { return setTimeout(function () { if (mapObject instanceof H.ui.InfoBubble) { ui.addBubble(mapObject); } }, _this.delay || 0); }); }; /** * @param {?} marker * @return {?} */ MapBubbleDirective.prototype.bindEvents = /** * @param {?} marker * @return {?} */ function (marker) { var _this = this; marker.addEventListener('tap', function (e) { if (_this._clickable) { _this.click.emit(e); } }); }; MapBubbleDirective.decorators = [ { type: Directive, args: [{ selector: 'map-bubble', providers: [ { provide: BaseMapComponent, useExisting: forwardRef(function () { return MapBubbleDirective; }) } ] },] } ]; /** @nocollapse */ MapBubbleDirective.ctorParameters = function () { return [ { type: HereMapsManager, }, ]; }; MapBubbleDirective.propDecorators = { "click": [{ type: Output },], "position": [{ type: Input },], "clickable": [{ type: Input },], "contentElement": [{ type: Input },], }; return MapBubbleDirective; }(BaseMapComponent)); export { MapBubbleDirective }; function MapBubbleDirective_tsickle_Closure_declarations() { /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */ MapBubbleDirective.decorators; /** * @nocollapse * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>} */ MapBubbleDirective.ctorParameters; /** @type {!Object<string,!Array<{type: !Function, args: (undefined|!Array<?>)}>>} */ MapBubbleDirective.propDecorators; /** @type {?} */ MapBubbleDirective.prototype.mapComponent; /** * This event is fired when the marker icon was clicked. * @type {?} */ MapBubbleDirective.prototype.click; /** @type {?} */ MapBubbleDirective.prototype._clickable; /** @type {?} */ MapBubbleDirective.prototype._mapsManager; } //# sourceMappingURL=map-bubble.js.map