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

jumpinjackie / mapguide-react-layout / 15160437878

21 May 2025 11:00AM UTC coverage: 21.631% (-42.6%) from 64.24%
15160437878

Pull #1552

github

web-flow
Merge 8b7153d9e into 236e2ea07
Pull Request #1552: Feature/package updates 2505

839 of 1165 branches covered (72.02%)

11 of 151 new or added lines in 25 files covered. (7.28%)

1332 existing lines in 50 files now uncovered.

4794 of 22163 relevant lines covered (21.63%)

6.89 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';
NEW
5
import DOMPurify from "dompurify";
×
6

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

55
    }
×
56
    public setText(prompt: string) {
×
57
        this.text = prompt;
×
58
        this.tooltipElement.innerHTML = this.text;
×
59
    }
×
60
    public clear() {
×
61
        this.text = null;
×
62
        this.tooltipElement.innerHTML = "";
×
63
    }
×
64
    public destroy() {
×
65
        if (this.tooltipElement && this.tooltipElement.parentNode) {
×
66
            this.tooltipElement.parentNode.removeChild(this.tooltipElement);
×
67
        }
×
68
    }
×
69
}
×
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