11import { intersect , difference } from 'muze-utils' ;
2- import { getFormattedSet } from './helper' ;
32import { BEHAVIOURS } from '../..' ;
43
54const fadeFn = ( set , context ) => {
6- const { formattedSet } = set ;
75 const {
86 mergedEnter,
97 mergedExit,
10- exitSet,
118 completeSet
12- } = formattedSet ;
9+ } = set ;
1310
1411 if ( ! mergedEnter . length && ! mergedExit . length ) {
1512 context . applyInteractionStyle ( completeSet , { interactionType : 'fade' , apply : false } ) ;
@@ -22,23 +19,21 @@ const fadeFn = (set, context) => {
2219 // Apply style only on the hovered layer
2320 if ( layerName === 'area' ) {
2421 context . applyInteractionStyle ( mergedEnter , { interactionType : 'fade' , apply : true } , [ layer ] ) ;
25- context . applyInteractionStyle ( exitSet , { interactionType : 'fade' , apply : false } , [ layer ] ) ;
22+ context . applyInteractionStyle ( mergedExit , { interactionType : 'fade' , apply : false } , [ layer ] ) ;
2623 } else {
27- context . applyInteractionStyle ( exitSet , { interactionType : 'fade' , apply : true } , [ layer ] ) ;
24+ context . applyInteractionStyle ( mergedExit , { interactionType : 'fade' , apply : true } , [ layer ] ) ;
2825 context . applyInteractionStyle ( mergedEnter , { interactionType : 'fade' , apply : false } , [ layer ] ) ;
2926 }
3027 } ) ;
3128 }
3229} ;
3330
3431const fadeOnBrushFn = ( set , context , payload ) => {
35- const { formattedSet } = set ;
3632 const {
37- exitSet,
3833 mergedEnter,
3934 mergedExit,
4035 completeSet
41- } = formattedSet ;
36+ } = set ;
4237
4338 const { dragEnd } = payload ;
4439 let interactionType = 'brushStroke' ;
@@ -60,7 +55,7 @@ const fadeOnBrushFn = (set, context, payload) => {
6055 // Apply style only on the hovered layer
6156 if ( layerName === 'area' ) {
6257 if ( dragEnd ) {
63- context . applyInteractionStyle ( exitSet , { interactionType : 'fade' , apply : false } , [ layer ] ) ;
58+ context . applyInteractionStyle ( mergedExit , { interactionType : 'fade' , apply : false } , [ layer ] ) ;
6459 mergedEnter . length &&
6560 context . applyInteractionStyle ( mergedEnter , { interactionType : 'focus' , apply : true } , [ layer ] ) ;
6661 }
@@ -85,13 +80,11 @@ export const strategies = {
8580 fade : fadeFn ,
8681 fadeOnBrush : fadeOnBrushFn ,
8782 focus : ( set , context ) => {
88- const { formattedSet } = set ;
8983 const {
90- entrySet,
9184 mergedEnter,
9285 mergedExit,
9386 completeSet
94- } = formattedSet ;
87+ } = set ;
9588 const { firebolt } = context ;
9689
9790 if ( ! mergedEnter . length && ! mergedExit . length ) {
@@ -100,7 +93,7 @@ export const strategies = {
10093 context . applyInteractionStyle ( completeSet , { interactionType : 'commonDoubleStroke' , apply : false } ) ;
10194 } else {
10295 context . applyInteractionStyle ( mergedExit , { interactionType : 'focusStroke' , apply : false } ) ;
103- context . applyInteractionStyle ( entrySet , { interactionType : 'focusStroke' , apply : true } ) ;
96+ context . applyInteractionStyle ( mergedEnter , { interactionType : 'focusStroke' , apply : true } ) ;
10497
10598 const payload = firebolt . getPayload ( BEHAVIOURS . HIGHLIGHT ) || { } ;
10699 const entryExitSet = firebolt . getEntryExitSet ( BEHAVIOURS . HIGHLIGHT ) ;
@@ -139,9 +132,7 @@ export const strategies = {
139132 } ) ;
140133 }
141134 } ,
142- highlight : ( set , context , payload , excludeSetIds ) => {
143- const { selectionSet } = set ;
144-
135+ highlight : ( selectionSet , context , payload ) => {
145136 if ( ! selectionSet . mergedEnter . length && ! selectionSet . mergedExit . length ) {
146137 // Remove focusStroke on selected but currently non-highlighted set
147138 context . applyInteractionStyle ( selectionSet . completeSet , { interactionType : 'highlight' , apply : false } ) ;
@@ -154,9 +145,7 @@ export const strategies = {
154145 layers . forEach ( ( layer ) => {
155146 if ( payload . target !== null ) {
156147 // get uids of only the currently highlighted point
157- const actualPoint = layer . getUidsFromPayload ( selectionSet . mergedEnter , payload . target ) ;
158- // get uids of only the currently highlighted point excluding the excludeSet ids
159- const currentHighlightedSet = getFormattedSet ( actualPoint , excludeSetIds ) ;
148+ const currentHighlightedSet = layer . getUidsFromPayload ( selectionSet . mergedEnter , payload . target ) ;
160149
161150 // Apply highlight on the currently hovered point
162151 context . applyInteractionStyle ( currentHighlightedSet ,
@@ -171,9 +160,9 @@ export const strategies = {
171160
172161 const selectEntrySet = context . firebolt . getEntryExitSet ( 'select' ) ;
173162 if ( selectEntrySet ) {
174- const commonSet = intersect ( selectEntrySet . mergedEnter . uids , actualPoint . uids ,
163+ const commonSet = intersect ( selectEntrySet . mergedEnter . uids , currentHighlightedSet . uids ,
175164 [ v => v [ 0 ] , v => v [ 0 ] ] ) ;
176- const diffSet = difference ( selectEntrySet . mergedEnter . uids , actualPoint . uids ,
165+ const diffSet = difference ( selectEntrySet . mergedEnter . uids , currentHighlightedSet . uids ,
177166 [ v => v [ 0 ] , v => v [ 0 ] ] ) ;
178167
179168 if ( commonSet . length ) {
@@ -192,10 +181,9 @@ export const strategies = {
192181 }
193182 } ,
194183 pseudoFocus : ( set , context ) => {
195- const { formattedSet } = set ;
196184 const {
197185 mergedEnter
198- } = formattedSet ;
186+ } = set ;
199187
200188 context . applyInteractionStyle ( mergedEnter , { interactionType : 'focus' , apply : false } ) ;
201189 }
0 commit comments