Sha256: 7f395c422d275f8190daea1f9fc3fabbb05ba96ec269d34a48c87ddb0846dbbc

Contents?: true

Size: 1.16 KB

Versions: 35

Compression:

Stored size: 1.16 KB

Contents

"use strict";

function NewButton() {

    var _map = null;
    var _this = this;
    _this.state = 'init'; // creating / editing
    _this.el = null;

    _this.setState = function (state) {

        _this.state = state;
        _this.el.removeClass('creating');
        _this.el.removeClass('editing');
        _this.el.addClass(state);

        _map.setMode(state);

    };

    _this.resetState = function () {
        _this.state = 'editing';
        _this.el.removeClass('creating');
        _this.el.removeClass('editing');
        _this.el.addClass('editing');
    };

    _this.onClick = function (e) {
        if (_this.el.hasClass('disabled')) return;
        e.preventDefault();

        if (_this.state == 'creating') {
            _this.setState('editing');
        } else {
            //console.log("<NewButton.onClick> Переходим в режим создания полигона.");
            _this.setState('creating');
        }
    };

    _this.init = function (button_css_selector, link_to_map) {
        _map = link_to_map;
        _this.el = $(button_css_selector);
        _this.setState(_map.mode);
        _this.el.on('click', _this.onClick);
    };
}

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
c80_map_floors-0.2.2 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.2.1 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.2.0.8 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.2.0.7 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.2.0.6 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.2.0.5 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.2.0.4 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.2.0.3 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.2.0.2 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.2.0.1 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.2.0.0 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.1.0.25 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.1.0.24 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.1.0.23 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.1.0.22 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.1.0.21 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.1.0.20 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.1.0.19 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.1.0.18 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.1.0.17 app/assets/javascripts/buttons/admin_buttons/button_new.js