Sha256: f280c42cf20df244052e7d1ed5af28bebd201bcda14ff13d6eb283c95cabdefb

Contents?: true

Size: 1.32 KB

Versions: 5

Compression:

Stored size: 1.32 KB

Contents

"use strict";

function BackToMapButton() {

    var _map = null;
    var _this = this;

    var _cnt = null;
    var _btn = null;

    var _onClick = function () {
        _map.setMode('viewing');

        if (_map.current_building) {
            _map.current_building.exit();
            _map.current_building = null;
        }

        if (_map.current_area) {
            _map.current_area.exit();
            _map.current_area = null;
        }

        _map.svgRemoveAllNodes();
        _map.draw_childs(_map.data["childs"]);

        if (_map.initial_map_position != null) {
            _map.moveTo(
                _map.initial_map_position.x,
                _map.initial_map_position.y,
                _map.initial_map_position.scale,
                400,
                'easeInOutCubic'
            );
        }

    };

    _this.init = function (parent_div_selector, link_to_map) {
        _map = link_to_map;
        _cnt = $('<div></div>').addClass('back_to_map_button');
        _cnt.appendTo($(parent_div_selector));
        _btn = $('<a href="#" id="BackToMapButton">Обратно на карту</a>');
        _btn.on('click', _onClick);
        _cnt.append(_btn);
    };

    _this.show = function () {
        _cnt.css('display', 'block');
    };

    _this.hide = function () {
        _cnt.css('display', 'none');
    }

}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
c80_map-0.1.0.15 app/assets/javascripts/buttons/button_back_to_map.js
c80_map-0.1.0.14 app/assets/javascripts/buttons/button_back_to_map.js
c80_map-0.1.0.13 app/assets/javascripts/buttons/button_back_to_map.js
c80_map-0.1.0.12 app/assets/javascripts/buttons/button_back_to_map.js
c80_map-0.1.0.11 app/assets/javascripts/buttons/button_back_to_map.js