@@ -6,7 +6,7 @@ import Path from '../../../core/Path';
66import { random } from '../../../core/Utilities' ;
77import { setupKeyListeners } from '../../../core/KeyboardInteractions' ;
88import Settings from './Settings' ;
9- import { GreekStatue } from './AttractorPatterns' ;
9+ import { GreekStatue , GreekStatueExtents } from './AttractorPatterns' ;
1010
1111let canvas , ctx ;
1212let network ;
@@ -44,20 +44,34 @@ let resetNetwork = () => {
4444 let addAttractors = ( ) => {
4545 let attractors = [ ] ;
4646
47+ // Scale the coordinates to fit within the window
48+ const scale = Math . min (
49+ window . innerWidth / GreekStatueExtents . width ,
50+ window . innerHeight / GreekStatueExtents . height
51+ ) * 0.8 ; // 0.8 to leave some margin
52+
53+ // Center the pattern in the middle of the window
54+ const offsetX = ( window . innerWidth - ( GreekStatueExtents . width * scale ) ) / 2 ;
55+ const offsetY = ( window . innerHeight - ( GreekStatueExtents . height * scale ) ) / 2 ;
56+
4757 for ( let coords of GreekStatue ) {
58+ const x = ( coords [ 0 ] - GreekStatueExtents . minX ) * scale + offsetX ;
59+ const y = ( coords [ 1 ] - GreekStatueExtents . minY ) * scale + offsetY ;
60+
4861 attractors . push (
4962 new Attractor (
50- new Vec2 (
51- coords [ 0 ] * 1.1 - 750 ,
52- coords [ 1 ] * 1.1 - 90
53- ) ,
63+ new Vec2 ( x , y ) ,
5464 ctx ,
5565 Settings
5666 )
5767 ) ;
5868 }
5969
6070 network . attractors = attractors ;
71+
72+ for ( let attractor of network . attractors ) {
73+ attractor . settings = network . settings ;
74+ }
6175 }
6276
6377 // Create the network with initial conditions
@@ -66,7 +80,7 @@ let resetNetwork = () => {
6680 new Node (
6781 null ,
6882 new Vec2 (
69- window . innerWidth / 2 - 440 ,
83+ window . innerWidth / 2 - 190 ,
7084 window . innerHeight / 2 + 100
7185 ) ,
7286 false ,
0 commit comments