File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 32
32
// The current state of the ribbon
33
33
state = STATE_CLOSED ,
34
34
35
+ // The last event sent so we don't dispatch multiple times
36
+ last_event = '' ,
37
+
35
38
// Ribbon text, correlates to states
36
39
closedText = '' ,
37
40
detachedText = '' ,
187
190
function detach ( ) {
188
191
state = STATE_DETACHED ;
189
192
dom . ribbonTag . innerHTML = detachedText ;
193
+ dispatchEvent ( 'forkit-hover' ) ;
190
194
}
191
195
192
196
function animate ( ) {
275
279
anchorB . y += ( anchorA . y - anchorB . y ) * 0.2 ;
276
280
277
281
rotation += ( 45 - rotation ) * 0.2 ;
282
+ dispatchEvent ( 'forkit-out' ) ;
278
283
}
279
284
}
280
285
322
327
}
323
328
324
329
function dispatchEvent ( type ) {
325
- var event = document . createEvent ( 'HTMLEvents' , 1 , 2 ) ;
326
- event . initEvent ( type , true , true ) ;
327
- dom . ribbon . dispatchEvent ( event ) ;
330
+ if ( last_event != type ) {
331
+ var event = document . createEvent ( 'HTMLEvents' , 1 , 2 ) ;
332
+ event . initEvent ( type , true , true ) ;
333
+ dom . ribbon . dispatchEvent ( event ) ;
334
+ }
328
335
}
329
336
330
337
/**
You can’t perform that action at this time.
0 commit comments