File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change 220220 }
221221 } ;
222222
223- $scope . rightClickNodeLabel = function ( targetNode ) {
223+ $scope . rightClickNodeLabel = function ( targetNode , $event ) {
224224
225- // Are are we changing the 'selected' node (as well)?
226- if ( $scope . selectedNode != targetNode ) {
227- this . selectNodeLabel ( targetNode ) ;
228- }
229-
230- // ...and do the rightClick
225+ // Is there a right click function??
231226 if ( $scope . onRightClick ) {
227+
228+ // Turn off the browser default context-menu
229+ if ( $event )
230+ $event . preventDefault ( ) ;
231+
232+ // Are are we changing the 'selected' node (as well)?
233+ if ( $scope . selectedNode != targetNode ) {
234+ this . selectNodeLabel ( targetNode ) ;
235+ }
236+
237+ // Finally go do what they asked
232238 $scope . onRightClick ( { node : targetNode } ) ;
233239 }
234240 } ;
336342 var fn = $parse ( attrs . treeRightClick ) ;
337343 element . bind ( 'contextmenu' , function ( event ) {
338344 scope . $apply ( function ( ) {
339- event . preventDefault ( ) ; // Don't show the browser's normal context menu
340- fn ( scope , { $event :event } ) ; // go do our stuff
345+ fn ( scope , { $event :event } ) ; // go do our stuff
341346 } ) ;
342347 } ) ;
343348 } ;
You can’t perform that action at this time.
0 commit comments