Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SvgMap

A SvgMap is defined in a SVG file and it's correspond to the svg tag element

The SvgMap elements contain an SVGImageElement and a series of Region2d elements.

This image define the maximum viewBox of the SVG, so it MUST define the x, y, width, height attributes.

By default this image must have the id equal to "background", you can change the query selector with SvgMap.Options.backgroundSelector

Example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg [...] >
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0">
    <image id="background" width="600" height="600" x="0" y="0" xlink:href=" ... "/>
    ... see Region2d api ...
</svg>

Hierarchy

  • SvgMap

Index

Constructors

constructor

  • new SvgMap(object: HTMLObjectElement): SvgMap

Properties

HLoaded

HLoaded: Handle<function> = new Event.Handle <(map: this) => void> ()

HSelectionChanged

HSelectionChanged: Handle<function> = new Event.Handle <(map: this) => void> ()

background

background: SVGImageElement

container

container: HTMLObjectElement

Private defsElement

defsElement: SVGDefsElement

Protected displayMode

displayMode: "ghost" | "normal" = "normal"

doc

doc: Document

filtersRegister

filtersRegister: object

Type declaration

  • [key: string]: string

Private mobileMode

mobileMode: boolean = isRunningOnMobile

options

options: Options = new SvgMap.Options ()

regions

regions: RegionCollection = new RegionCollection (this)

root

root: SVGSVGElement

Private selectedSapes

selectedSapes: Region2d[] = []

Methods

Private createBackgroundElement

getSelected

Private initBackground

Private initFilters

  • initFilters(): void

Private initRegions

  • initRegions(defs: IJson[]): void

load

  • load(url: string): void

Private loadDefinitions

  • loadDefinitions(url: string): Promise<IJson>

Private onBackgroundClick

  • onBackgroundClick(evt: Event): void

Private onOverBackground

  • onOverBackground(region: Region2d, evt: MouseEvent): void

Private onOverRegion

  • onOverRegion(region: Region2d, evt: MouseEvent): void

Private onRegionAdded

Private onRegionSelected

  • onRegionSelected(region: Region2d, evt: MouseEvent): void

Private onRegionUnelected

  • onRegionUnelected(region: Region2d, evt: MouseEvent): void

select

setDisplayMode

  • setDisplayMode(mode: "ghost" | "normal"): void
  • Parameters

    • mode: "ghost" | "normal"

    Returns void

setMobileMode

  • setMobileMode(v?: boolean): void
  • Active or desactive the mouse over event for mobile view.

    Parameters

    • Default value v: boolean = true

    Returns void

unselect

updateDisplay

  • updateDisplay(): void

zoomTo

  • zoomTo(b: SVGRect, margin?: number): void
  • Parameters

    • b: SVGRect
    • Default value margin: number = 0

    Returns void

zoomToAll

  • zoomToAll(): void

Generated using TypeDoc