Skip to content

philosophocat/moscow_metro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

66ca9cd · Jan 21, 2019

History

24 Commits
Jan 21, 2019
Jan 21, 2019
Sep 25, 2018
Jan 21, 2019
Jan 21, 2019
Nov 11, 2018
Jan 21, 2019
Jan 21, 2019
Jan 21, 2019
Jan 21, 2019
Jan 21, 2019

Repository files navigation

moscow_metro

Scalable vector moscow metro map (demo)

npm version

Usage

    const container = document.body;
    const options = {
        selectable: false,  // default true
        check_icons: false, // default true
        parking: false,     // default true
        legend: false,      // default true
        river: false,       // default true
        zoom: {
            k: 1.5,         // default 1.25,
            min: -5,        // default -7
            max: 5          // default 7
        }
    };
    const map = new MoscowMetro(container, options);
    
    // middleware, fires on every station click
    map.use((station, next) => {
        // do something
        next();
    });
    
    // zoom
    map.zoomIn();
    map.zoomOut();
    
    // selecting
    map.select(81);         // or [80, 81]
    map.deselect(81);       // or [80, 81] 
    map.getAll();
    map.getSelected();
    
    // destroy
    map.destroy();

Contribute

Feel free to push your code if you agree with publishing under the MIT license