@@ -1371,6 +1371,68 @@ class VolumeImageViewer {
13711371 } )
13721372 } )
13731373
1374+ let clickEvent = null
1375+ this [ _map ] . on ( 'dblclick' , ( event ) => {
1376+ clickEvent = 'dblclick'
1377+ this [ _map ] . forEachFeatureAtPixel (
1378+ event . pixel ,
1379+ ( feature ) => {
1380+ const correctFeature = feature . values_ ?. features ?. [ 0 ] || feature
1381+ console . debug ( 'dblclick feature id:' , correctFeature )
1382+ if ( correctFeature ?. getId ( ) ) {
1383+ publish (
1384+ this [ _map ] . getTargetElement ( ) ,
1385+ EVENT . ROI_SELECTED ,
1386+ this . _getROIFromFeature (
1387+ correctFeature ,
1388+ this [ _pyramid ] . metadata ,
1389+ this [ _affine ]
1390+ )
1391+ )
1392+ publish (
1393+ this [ _map ] . getTargetElement ( ) ,
1394+ EVENT . ROI_DOUBLE_CLICKED ,
1395+ this . _getROIFromFeature (
1396+ correctFeature ,
1397+ this [ _pyramid ] . metadata ,
1398+ this [ _affine ]
1399+ )
1400+ )
1401+ }
1402+ clickEvent = null
1403+ } ,
1404+ { hitTolerance : 1 }
1405+ )
1406+ } )
1407+ this [ _map ] . on ( 'click' , ( event ) => {
1408+ if ( clickEvent === 'dblclick' ) {
1409+ event . preventDefault ( )
1410+ event . stopPropagation ( )
1411+ return
1412+ }
1413+ clickEvent = 'click'
1414+ this [ _map ] . forEachFeatureAtPixel (
1415+ event . pixel ,
1416+ ( feature ) => {
1417+ const correctFeature = feature . values_ ?. features ?. [ 0 ] || feature
1418+ console . debug ( 'click feature id:' , correctFeature )
1419+ if ( correctFeature ?. getId ( ) ) {
1420+ publish (
1421+ this [ _map ] . getTargetElement ( ) ,
1422+ EVENT . ROI_SELECTED ,
1423+ this . _getROIFromFeature (
1424+ correctFeature ,
1425+ this [ _pyramid ] . metadata ,
1426+ this [ _affine ]
1427+ )
1428+ )
1429+ }
1430+ clickEvent = null
1431+ } ,
1432+ { hitTolerance : 1 }
1433+ )
1434+ } )
1435+
13741436 view . fit ( this [ _projection ] . getExtent ( ) , { size : this [ _map ] . getSize ( ) } )
13751437
13761438 /**
@@ -2500,15 +2562,18 @@ class VolumeImageViewer {
25002562 const container = this [ _map ] . getTargetElement ( )
25012563
25022564 this [ _interactions ] . select . on ( 'select' , ( e ) => {
2503- publish (
2504- container ,
2505- EVENT . ROI_SELECTED ,
2506- this . _getROIFromFeature (
2507- e . selected [ 0 ] ,
2508- this [ _pyramid ] . metadata ,
2509- this [ _affine ]
2565+ console . debug ( 'select roi' )
2566+ if ( e . selected [ 0 ] ?. getId ( ) ) {
2567+ publish (
2568+ container ,
2569+ EVENT . ROI_SELECTED ,
2570+ this . _getROIFromFeature (
2571+ e . selected [ 0 ] ,
2572+ this [ _pyramid ] . metadata ,
2573+ this [ _affine ]
2574+ )
25102575 )
2511- )
2576+ }
25122577 } )
25132578
25142579 this [ _map ] . addInteraction ( this [ _interactions ] . select )
@@ -3362,33 +3427,31 @@ class VolumeImageViewer {
33623427
33633428 let selectedAnnotation = null
33643429 this [ _map ] . on ( 'singleclick' , ( e ) => {
3365- if ( e != null ) {
3366- if ( selectedAnnotation != null ) {
3367- selectedAnnotation . set ( 'selected' , 0 )
3368- selectedAnnotation = null
3369- }
3370- const container = this [ _map ] . getTargetElement ( )
3371- this [ _map ] . forEachFeatureAtPixel (
3372- e . pixel ,
3373- ( feature ) => {
3374- if ( feature != null ) {
3375- feature . set ( 'selected' , 1 )
3376- selectedAnnotation = feature
3377- publish (
3378- container ,
3379- EVENT . ROI_SELECTED ,
3380- _getROIFromFeature ( feature )
3381- )
3382- return true
3383- }
3384- return false
3385- } ,
3386- {
3387- hitTolerance : 1 ,
3388- layerFilter : ( layer ) => ( layer instanceof PointsLayer )
3389- }
3390- )
3430+ if ( selectedAnnotation !== null ) {
3431+ selectedAnnotation . set ( 'selected' , 0 )
3432+ selectedAnnotation = null
33913433 }
3434+ const container = this [ _map ] . getTargetElement ( )
3435+ this [ _map ] . forEachFeatureAtPixel (
3436+ e . pixel ,
3437+ ( feature ) => {
3438+ if ( feature != null ) {
3439+ feature . set ( 'selected' , 1 )
3440+ selectedAnnotation = feature
3441+ publish (
3442+ container ,
3443+ EVENT . ROI_SELECTED ,
3444+ _getROIFromFeature ( feature )
3445+ )
3446+ return true
3447+ }
3448+ return false
3449+ } ,
3450+ {
3451+ hitTolerance : 1 ,
3452+ layerFilter : ( layer ) => ( layer instanceof PointsLayer )
3453+ }
3454+ )
33923455 } )
33933456 }
33943457
0 commit comments