@@ -108,6 +108,7 @@ class TreeViewControl {
108
108
109
109
if ( data . enabled !== false ) {
110
110
this . _container . addEventListener ( 'click' , this . onClick . bind ( this ) ) ;
111
+ this . _container . addEventListener ( 'dblclick' , this . onDoubleClick . bind ( this ) ) ;
111
112
}
112
113
}
113
114
@@ -552,34 +553,13 @@ class TreeViewControl {
552
553
}
553
554
}
554
555
555
- /*var doubleClickFunction = this.createClickFunction(
556
- tr,
557
- selectionElement,
558
- false,
559
- true,
560
- builder,
561
- treeViewData,
562
- entry,
563
- );
564
-
565
- this.setupEntryMouseEvents(
566
- tr,
567
- entry,
568
- treeViewData,
569
- builder,
570
- selectionElement,
571
- expander,
572
- clickFunction,
573
- doubleClickFunction,
574
- );
575
-
576
- this.setupEntryKeyEvent(
556
+ /*this.setupEntryKeyEvent(
577
557
tr,
578
558
entry,
579
559
selectionElement,
580
560
expander,
581
561
clickFunction,
582
- ); */
562
+ );*/
583
563
584
564
this . setupEntryContextMenuEvent ( tr , entry , treeViewData , builder ) ;
585
565
}
@@ -602,44 +582,6 @@ class TreeViewControl {
602
582
} ) ;
603
583
}
604
584
605
- setupEntryMouseEvents (
606
- tr : HTMLElement ,
607
- entry : TreeEntryJSON ,
608
- treeViewData : TreeWidgetJSON ,
609
- builder : any ,
610
- selectionElement : HTMLInputElement ,
611
- expander : HTMLElement ,
612
- clickFunction : any ,
613
- doubleClickFunction : any ,
614
- ) {
615
- tr . addEventListener ( 'click' , clickFunction as any ) ;
616
-
617
- if ( ! this . _singleClickActivate ) {
618
- if ( window . ThisIsTheiOSApp ) {
619
- // TODO: remove this hack
620
- tr . addEventListener ( 'click' , ( ) => {
621
- if ( L . DomUtil . hasClass ( tr , 'disabled' ) ) return ;
622
-
623
- if (
624
- entry . row == lastClickHelperRow &&
625
- treeViewData . id == lastClickHelperId
626
- )
627
- doubleClickFunction ( undefined ) ;
628
- else {
629
- lastClickHelperRow = entry . row ;
630
- lastClickHelperId = treeViewData . id ;
631
- setTimeout ( ( ) => {
632
- lastClickHelperRow = - 1 ;
633
- } , 300 ) ;
634
- }
635
- } ) ;
636
- // TODO: remove this hack
637
- } else {
638
- $ ( tr ) . dblclick ( doubleClickFunction as any ) ;
639
- }
640
- }
641
- }
642
-
643
585
setupEntryKeyEvent (
644
586
tr : HTMLElement ,
645
587
entry : TreeEntryJSON ,
@@ -1212,6 +1154,26 @@ class TreeViewControl {
1212
1154
this . toggleEntry ( expander , this . _data , expander . _row , this . _builder ) ;
1213
1155
}
1214
1156
}
1157
+
1158
+ onDoubleClick ( e : any ) {
1159
+ let target = e . target ;
1160
+ let row = TreeViewControl . getElement ( target , 'row' ) ;
1161
+ if ( row && ! L . DomUtil . hasClass ( row , 'disabled' ) ) {
1162
+ this . onRowDoubleClick ( row ) ;
1163
+ }
1164
+ }
1165
+
1166
+ onRowDoubleClick ( row : any ) {
1167
+ if ( ! this . _singleClickActivate ) {
1168
+ this . _builder . callback (
1169
+ 'treeview' ,
1170
+ 'activate' ,
1171
+ this . _data ,
1172
+ row . _row ,
1173
+ this . _builder ,
1174
+ ) ;
1175
+ }
1176
+ }
1215
1177
}
1216
1178
1217
1179
JSDialog . treeView = function (
0 commit comments