Projekt

Obecné

Profil

« Předchozí | Další » 

Revize a36ba034

Přidáno uživatelem Martin Matas před téměř 6 roky(ů)

Improved deselection interaction (refs #7464)

Zobrazit rozdíly:

sources/imiger-core/src/main/webapp/timeline/js/cz/kajda/timeline/Timeline.js
44 44
     */
45 45
    _constructor : function(htmlElement, options) {
46 46
        Component.call(this, null);
47
        
47

  
48
        this._selected = false;
49
        this._selectedEntity = null;
48 50
        this._htmlElement = htmlElement;
49 51
        this._options =  $.extend(this._defaults, options);
50 52
        this._zoomLevel = this._options.defaultZoomLevel;
......
483 485
                $(window).on("resize", new Closure(this, this._handleResizing));
484 486
                $(document).on("imigerClick", new Closure(this, this._handleIMiGErClick));
485 487
                this._htmlElement
486
                        .on("contextmenu", new Closure(this, this._handleRightClick))
487 488
                        .on("mouseover", "*", new Closure(this, this._handleMouseOver))
488 489
                        .on("wheel", new Closure(this, this._handleZooming))
489 490
                        .on("keypress keydown", new Closure(this, this._handleKeyboard))
......
502 503
            _handleIMiGErClick : function(e) {
503 504
                var entity = this.getEntities().get(e.originalEvent.detail.entityID),
504 505
                    bandItem = this._bandGroup.getBand(e.originalEvent.detail.archetype).getBandItem(entity.getId());
506

  
507
                if (this._selected) {
508
                    this.blur();
509
                    e.preventDefault();
510
                    this._selected = false;
511
                    if (this._selectedEntity === entity.getId()) {
512
                        return;
513
                    }
514
                }
505 515
                
506 516
                this.focusItem(bandItem.getEntity(), false);
507 517
                this._fireEvent("itemClick", entity);
508 518
                // FIALA Event for item click
509 519
                this._fireEvent("itemLogClick", entity);
510
            },
511

  
512
            /**
513
             * @private 
514
             * Right click or context menu event handler.
515
             * @param {jQuery.Event} e
516
             */
517
            _handleRightClick : function(e) {
518
                this.blur();
519
                e.preventDefault();
520
                this._selected = true;
521
                this._selectedEntity = entity.getId();
520 522
            },
521 523

  
522 524
            /**
......
617 619
                // imiger trigger
618 620
                var ev = new CustomEvent('timelineClick', { detail: entity.getId() });
619 621
                window.parent.document.dispatchEvent(ev);
622

  
623
                if (this._selected) {
624
                    this.blur();
625
                    e.preventDefault();
626
                    this._selected = false;
627
                    if (this._selectedEntity === entity.getId()) {
628
                        return;
629
                    }
630
                }
620 631
                
621 632
                this.focusItem(bandItem.getEntity(), false);
622 633
                this._fireEvent("itemClick", entity);
623 634
                // FIALA Event for item click
624 635
                this._fireEvent("itemLogClick", entity);
636
                this._selected = true;
637
                this._selectedEntity = entity.getId();
625 638
            },
626 639

  
627 640
            /**

Také k dispozici: Unified diff