• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jumpinjackie / mapguide-react-layout / 15165370206

21 May 2025 02:48PM UTC coverage: 22.447%. Remained the same
15165370206

push

github

jumpinjackie
#1555: More internalization of things that shouldn't be in the API documentation.

Also dd merge-modules plugin for typedoc which flattens our public symbol list, which makes better sense as our node module usage story is to import from a flat barrel "mapguide-react-layout" module.

878 of 1206 branches covered (72.8%)

4975 of 22163 relevant lines covered (22.45%)

6.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/components/tooltips/utfgrid.ts
1
import olOverlay from "ol/Overlay";
×
2
import olMap from "ol/Map";
3
import UTFGridSource from "ol/source/UTFGrid";
4
import { GenericEvent } from '../../api/common';
5
import DOMPurify from "dompurify";
×
6

7
/**
8
 * @hidden
9
 */
10
export class UTFGridTrackingTooltip {
×
11
    private tooltip: olOverlay;
12
    private tooltipElement: HTMLElement;
13
    private text: string | null;
14
    constructor(private map: olMap,
×
15
        private gridSource: UTFGridSource,
×
16
        private isContextMenuOpen: () => boolean) {
×
17
        this.map.getViewport().addEventListener("mouseout", this.onMouseOut.bind(this));
×
18
        this.tooltipElement = document.createElement("div");
×
19
        this.tooltipElement.className = 'feature-tooltip';
×
20
        this.tooltip = new olOverlay({
×
21
            element: this.tooltipElement,
×
22
            offset: [15, 0],
×
23
            positioning: 'center-left'
×
24
        })
×
25
        this.map.addOverlay(this.tooltip);
×
26
        this.text = null;
×
27
    }
×
28
    public dispose() {
×
29
        this.tooltip.dispose();
×
30
    }
×
31
    public onMouseMove(e: GenericEvent) {
×
32
        if (this.isContextMenuOpen())
×
33
            return;
×
34
        //this.tooltip.setPosition(e.coordinate);
35
        const viewResolution = /** @type {number} */ (this.map.getView().getResolution());
×
36
        if (viewResolution) {
×
37
            this.gridSource.forDataAtCoordinateAndResolution(e.coordinate, viewResolution, (data) => {
×
38
                // If you want to use the template from the TileJSON,
39
                //  load the mustache.js library separately and call
40
                //
41
                //mapElement.style.cursor = data ? 'pointer' : '';
42
                if (data) {
×
43
                    var html = "";
×
44
                    if (data.MG_TOOLTIP)
×
45
                        html += DOMPurify.sanitize(data.MG_TOOLTIP.replace(/(\\n)+/g, '<br />'));
×
46
                    if (data.MG_URL) {
×
47
                        html += "<br/><br/>";
×
48
                        html += "<strong>CTRL + Click for more information</strong>";
×
49
                    }
×
50
                    this.tooltipElement.innerHTML = html
×
51
                }
×
52
                this.tooltip.setPosition(data ? e.coordinate : undefined);
×
53
            });
×
54
        }
×
55
    }
×
56
    private onMouseOut() {
×
57

58
    }
×
59
    public setText(prompt: string) {
×
60
        this.text = prompt;
×
61
        this.tooltipElement.innerHTML = this.text;
×
62
    }
×
63
    public clear() {
×
64
        this.text = null;
×
65
        this.tooltipElement.innerHTML = "";
×
66
    }
×
67
    public destroy() {
×
68
        if (this.tooltipElement && this.tooltipElement.parentNode) {
×
69
            this.tooltipElement.parentNode.removeChild(this.tooltipElement);
×
70
        }
×
71
    }
×
72
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc