Sha256: 894e52dc9a3154e7c6feacc8b5b5621a03d3e3385ee23c281bb07eced5c370ff

Contents?: true

Size: 1.16 KB

Versions: 19

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

19 entries across 19 versions & 2 rubygems

Version Path
c80_map-0.1.0.24 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map_floors-0.1.0.1 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.23 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.22 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.21 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.20 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.19 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.18 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.17 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.16 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.15 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.14 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.13 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.12 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.11 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.10 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.2 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0.1 app/assets/javascripts/buttons/admin_buttons/button_new.js
c80_map-0.1.0 app/assets/javascripts/buttons/admin_buttons/button_new.js