File tree Expand file tree Collapse file tree 1 file changed +23
-10
lines changed Expand file tree Collapse file tree 1 file changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import Card from './Card.js';
22import CardMain from './Card--main.js' ;
33import CardProjects from './Card--projects.js' ;
44
5-
65window . addEventListener ( 'load' , ( ) => {
76 const
87 CP = new CardProjects ( ) ,
@@ -13,22 +12,36 @@ window.addEventListener('load', () => {
1312 CM . mousemoveEvent ( ) ;
1413 C . mousemoveEvent ( ) ;
1514
16- window . addEventListener ( 'mousemove' , ( e ) => {
17- CP . doEvent ( e ) ;
18- CM . doEvent ( e ) ;
19- // TODO: do i need this? In which case?
20- // C.doEvent(e);
21- } ) ;
22-
2315 /**
2416 * flushes all caches that can be flushed
2517 * @returns {void }
2618 */
27- const onMove = ( ) => {
19+ function onMove ( ) {
2820 CP . flushRectCaches ( ) ;
2921 CM . flushRectCaches ( ) ;
3022 //C.flushRectCaches();
31- } ;
23+ }
24+
25+ let lastEvent = null ;
26+ function doEvent ( event = lastEvent ) {
27+ CP . doEvent ( event ) ;
28+ CM . doEvent ( event ) ;
29+ // TODO: do i need this? In which case?
30+ // C.doEvent(event);
31+ }
32+
33+ window . addEventListener ( 'mousemove' , ( e ) => {
34+ lastEvent = e ;
35+ doEvent ( ) ;
36+ } ) ;
37+
38+ /**
39+ * @todo this creates a dependency to the projects block by using
40+ * their classes, resolve somehow?
41+ */
42+ document . querySelector ( '.projects__inner' ) . addEventListener ( 'scroll' , ( e ) => {
43+ doEvent ( ) ;
44+ } ) ;
3245
3346 window . addEventListener ( 'pushstate' , onMove ) ;
3447 window . addEventListener ( 'popstate' , onMove ) ;
You can’t perform that action at this time.
0 commit comments