1515 \******************/
1616/***/ ( ( __unused_webpack_module , __unused_webpack_exports , __webpack_require__ ) => {
1717
18- eval ( "__webpack_require__.e(/*! import() */ \"pkg_index_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./pkg */ \"./pkg/index.js\"))\n .then(wasm => {\n const canvas = document.getElementById('canvas');\n const ctx = canvas.getContext('2d');\n\n let world;\n let wolrd_preset_actual;\n\n // Set world to the collision preset\n function worldCollision() {\n world = wasm.World.new();\n world.add_object(0., -380., 40., -100., 20., 20., 0.8, false);\n world.add_object(-80., 0., 100., -400., 30., 30., 0.8, false);\n world.add_object(200., 300., 0., 0., 30., 30., 0.8, true);\n }\n \n // Set world to the universal gravitation preset\n function worldUniversal() {\n world = wasm.World.new();\n world.add_object(0., 0., 0., 0., 50., 100000000000000000., 0.5, false);\n world.add_object(0., -300., 600., 0., 20., 10000000., 0.5, false);\n world.add_object(0., 200., -700., 0., 15., 5000000., 0.5, false);\n world.set_gravity_y(0.);\n world.set_meter_size(0.001);\n }\n\n function worldMultiCollision() {\n world = wasm.World.new();\n world.add_object(0., -380., 40., -100., 20., 20., 0.8, false);\n world.add_object(-200., 20., 0., 0., 30., 30., 0.8, false);\n }\n\n let world_dictionary = {\n \"collision\": worldCollision,\n \"universal\": worldUniversal,\n\n }\n\n wolrd_preset_actual = document.getElementById(\"world_preset\").value;\n world_dictionary[wolrd_preset_actual]();\n\n let view = wasm.WorldView.new(800, 800);\n\n document.getElementById(\"restart_button\").onclick = function (){\n world_dictionary[wolrd_preset_actual]();\n view.set_view_center(0., 0.);\n };\n\n let t = performance.now();\n\n function loop() {\n // Get the duration of the previous iteration.\n let elapsed_ms = performance.now() - t;\n t = performance.now();\n\n // Get values from the html file\n var world_preset = document.getElementById(\"world_preset\").value;\n var paused = document.getElementById(\"pause\").checked;\n var follow_enabled = document.getElementById(\"follow\").checked;\n var vector_enabled = document.getElementById(\"vectors\").checked;\n\n // Change the preset world if the selection changed\n if (world_preset !== wolrd_preset_actual) {\n wolrd_preset_actual = world_preset;\n world_dictionary[wolrd_preset_actual]();\n view.set_view_center(0., 0.);\n }\n\n // Apply physics.\n if (!paused) {\n world.apply_physic(elapsed_ms);\n }\n\n // Change the position of the view's center\n if (follow_enabled) {\n view.set_view_center(world.get_world().objects[0].pos_x, world.get_world().objects[0].pos_y);\n }\n\n // Draw the wolrd in the canvas\n view.draw(world, ctx);\n \n // Draw vectors\n if (vector_enabled) {\n view.draw_vectors(world, ctx, 1., document.getElementById(\"vectors_values\").checked);\n }\n\n requestAnimationFrame(loop);\n }\n\n // Start the simulation loop\n loop();\n\n })\n .catch(console.error);\n\n\n//# sourceURL=webpack:///./index.js?" ) ;
18+ eval ( "__webpack_require__.e(/*! import() */ \"pkg_index_js\").then(__webpack_require__.t.bind(__webpack_require__, /*! ./pkg */ \"./pkg/index.js\", 23))\n .then(wasm => {\n const canvas = document.getElementById('canvas');\n const ctx = canvas.getContext('2d');\n\n let world;\n let wolrd_preset_actual;\n\n // Set world to the collision preset\n function worldCollision() {\n world = wasm.World.new();\n world.add_object(0., -380., 40., -100., 20., 20., 0.8, false);\n world.add_object(-80., 0., 100., -400., 30., 30., 0.8, false);\n world.add_object(200., 300., 0., 0., 30., 30., 0.8, true);\n }\n \n // Set world to the universal gravitation preset\n function worldUniversal() {\n world = wasm.World.new();\n world.add_object(0., 0., 0., 0., 50., 100000000000000000., 0.5, false);\n world.add_object(0., -300., 600., 0., 20., 10000000., 0.5, false);\n world.add_object(0., 200., -700., 0., 15., 5000000., 0.5, false);\n world.set_gravity_y(0.);\n world.set_meter_size(0.001);\n }\n\n function worldMultiCollision() {\n world = wasm.World.new();\n world.add_object(0., -380., 40., -100., 20., 20., 0.8, false);\n world.add_object(-200., 20., 0., 0., 30., 30., 0.8, false);\n }\n\n let world_dictionary = {\n \"collision\": worldCollision,\n \"universal\": worldUniversal,\n\n }\n\n wolrd_preset_actual = document.getElementById(\"world_preset\").value;\n world_dictionary[wolrd_preset_actual]();\n\n let view = wasm.WorldView.new(800, 800);\n\n document.getElementById(\"restart_button\").onclick = function (){\n world_dictionary[wolrd_preset_actual]();\n view.set_view_center(0., 0.);\n };\n\n let t = performance.now();\n\n function loop() {\n // Get the duration of the previous iteration.\n let elapsed_ms = performance.now() - t;\n t = performance.now();\n\n // Get values from the html file\n var world_preset = document.getElementById(\"world_preset\").value;\n var paused = document.getElementById(\"pause\").checked;\n var follow_enabled = document.getElementById(\"follow\").checked;\n var vector_enabled = document.getElementById(\"vectors\").checked;\n\n // Change the preset world if the selection changed\n if (world_preset !== wolrd_preset_actual) {\n wolrd_preset_actual = world_preset;\n world_dictionary[wolrd_preset_actual]();\n view.set_view_center(0., 0.);\n }\n\n // Apply physics.\n if (!paused) {\n world.apply_physic(elapsed_ms);\n }\n\n // Change the position of the view's center\n if (follow_enabled) {\n view.set_view_center(world.get_world().objects[0].pos_x, world.get_world().objects[0].pos_y);\n }\n\n // Draw the wolrd in the canvas\n view.draw(world, ctx);\n \n // Draw vectors\n if (vector_enabled) {\n view.draw_vectors(world, ctx, 1., document.getElementById(\"vectors_values\").checked);\n }\n\n requestAnimationFrame(loop);\n }\n\n // Start the simulation loop\n loop();\n\n })\n .catch(console.error);\n\n\n//# sourceURL=webpack:///./index.js?" ) ;
1919
2020/***/ } )
2121
@@ -33,7 +33,7 @@ eval("__webpack_require__.e(/*! import() */ \"pkg_index_js\").then(__webpack_req
3333/******/ }
3434/******/ // Create a new module (and put it into the cache)
3535/******/ var module = __webpack_module_cache__ [ moduleId ] = {
36- /******/ id : moduleId ,
36+ /******/ // no module.id needed
3737/******/ // no module.loaded needed
3838/******/ exports : { }
3939/******/ } ;
@@ -49,72 +49,33 @@ eval("__webpack_require__.e(/*! import() */ \"pkg_index_js\").then(__webpack_req
4949/******/ __webpack_require__ . m = __webpack_modules__ ;
5050/******/
5151/************************************************************************/
52- /******/ /* webpack/runtime/async module */
52+ /******/ /* webpack/runtime/create fake namespace object */
5353/******/ ( ( ) => {
54- /******/ var webpackQueues = typeof Symbol === "function" ? Symbol ( "webpack queues" ) : "__webpack_queues__" ;
55- /******/ var webpackExports = typeof Symbol === "function" ? Symbol ( "webpack exports" ) : "__webpack_exports__" ;
56- /******/ var webpackError = typeof Symbol === "function" ? Symbol ( "webpack error" ) : "__webpack_error__" ;
57- /******/ var resolveQueue = ( queue ) => {
58- /******/ if ( queue && queue . d < 1 ) {
59- /******/ queue . d = 1 ;
60- /******/ queue . forEach ( ( fn ) => ( fn . r -- ) ) ;
61- /******/ queue . forEach ( ( fn ) => ( fn . r -- ? fn . r ++ : fn ( ) ) ) ;
54+ /******/ var getProto = Object . getPrototypeOf ? ( obj ) => ( Object . getPrototypeOf ( obj ) ) : ( obj ) => ( obj . __proto__ ) ;
55+ /******/ var leafPrototypes ;
56+ /******/ // create a fake namespace object
57+ /******/ // mode & 1: value is a module id, require it
58+ /******/ // mode & 2: merge all properties of value into the ns
59+ /******/ // mode & 4: return value when already ns object
60+ /******/ // mode & 16: return value when it's Promise-like
61+ /******/ // mode & 8|1: behave like require
62+ /******/ __webpack_require__ . t = function ( value , mode ) {
63+ /******/ if ( mode & 1 ) value = this ( value ) ;
64+ /******/ if ( mode & 8 ) return value ;
65+ /******/ if ( typeof value === 'object' && value ) {
66+ /******/ if ( ( mode & 4 ) && value . __esModule ) return value ;
67+ /******/ if ( ( mode & 16 ) && typeof value . then === 'function' ) return value ;
6268/******/ }
63- /******/ }
64- /******/ var wrapDeps = ( deps ) => ( deps . map ( ( dep ) => {
65- /******/ if ( dep !== null && typeof dep === "object" ) {
66- /******/ if ( dep [ webpackQueues ] ) return dep ;
67- /******/ if ( dep . then ) {
68- /******/ var queue = [ ] ;
69- /******/ queue . d = 0 ;
70- /******/ dep . then ( ( r ) => {
71- /******/ obj [ webpackExports ] = r ;
72- /******/ resolveQueue ( queue ) ;
73- /******/ } , ( e ) => {
74- /******/ obj [ webpackError ] = e ;
75- /******/ resolveQueue ( queue ) ;
76- /******/ } ) ;
77- /******/ var obj = { } ;
78- /******/ obj [ webpackQueues ] = ( fn ) => ( fn ( queue ) ) ;
79- /******/ return obj ;
80- /******/ }
69+ /******/ var ns = Object . create ( null ) ;
70+ /******/ __webpack_require__ . r ( ns ) ;
71+ /******/ var def = { } ;
72+ /******/ leafPrototypes = leafPrototypes || [ null , getProto ( { } ) , getProto ( [ ] ) , getProto ( getProto ) ] ;
73+ /******/ for ( var current = mode & 2 && value ; typeof current == 'object' && ! ~ leafPrototypes . indexOf ( current ) ; current = getProto ( current ) ) {
74+ /******/ Object . getOwnPropertyNames ( current ) . forEach ( ( key ) => ( def [ key ] = ( ) => ( value [ key ] ) ) ) ;
8175/******/ }
82- /******/ var ret = { } ;
83- /******/ ret [ webpackQueues ] = x => { } ;
84- /******/ ret [ webpackExports ] = dep ;
85- /******/ return ret ;
86- /******/ } ) ) ;
87- /******/ __webpack_require__ . a = ( module , body , hasAwait ) => {
88- /******/ var queue ;
89- /******/ hasAwait && ( ( queue = [ ] ) . d = - 1 ) ;
90- /******/ var depQueues = new Set ( ) ;
91- /******/ var exports = module . exports ;
92- /******/ var currentDeps ;
93- /******/ var outerResolve ;
94- /******/ var reject ;
95- /******/ var promise = new Promise ( ( resolve , rej ) => {
96- /******/ reject = rej ;
97- /******/ outerResolve = resolve ;
98- /******/ } ) ;
99- /******/ promise [ webpackExports ] = exports ;
100- /******/ promise [ webpackQueues ] = ( fn ) => ( queue && fn ( queue ) , depQueues . forEach ( fn ) , promise [ "catch" ] ( x => { } ) ) ;
101- /******/ module . exports = promise ;
102- /******/ body ( ( deps ) => {
103- /******/ currentDeps = wrapDeps ( deps ) ;
104- /******/ var fn ;
105- /******/ var getResult = ( ) => ( currentDeps . map ( ( d ) => {
106- /******/ if ( d [ webpackError ] ) throw d [ webpackError ] ;
107- /******/ return d [ webpackExports ] ;
108- /******/ } ) )
109- /******/ var promise = new Promise ( ( resolve ) => {
110- /******/ fn = ( ) => ( resolve ( getResult ) ) ;
111- /******/ fn . r = 0 ;
112- /******/ var fnQueue = ( q ) => ( q !== queue && ! depQueues . has ( q ) && ( depQueues . add ( q ) , q && ! q . d && ( fn . r ++ , q . push ( fn ) ) ) ) ;
113- /******/ currentDeps . map ( ( dep ) => ( dep [ webpackQueues ] ( fnQueue ) ) ) ;
114- /******/ } ) ;
115- /******/ return fn . r ? promise : getResult ( ) ;
116- /******/ } , ( err ) => ( ( err ? reject ( promise [ webpackError ] = err ) : outerResolve ( exports ) ) , resolveQueue ( queue ) ) ) ;
117- /******/ queue && queue . d < 0 && ( queue . d = 0 ) ;
76+ /******/ def [ 'default' ] = ( ) => ( value ) ;
77+ /******/ __webpack_require__ . d ( ns , def ) ;
78+ /******/ return ns ;
11879/******/ } ;
11980/******/ } ) ( ) ;
12081/******/
@@ -226,35 +187,6 @@ eval("__webpack_require__.e(/*! import() */ \"pkg_index_js\").then(__webpack_req
226187/******/ } ;
227188/******/ } ) ( ) ;
228189/******/
229- /******/ /* webpack/runtime/wasm loading */
230- /******/ ( ( ) => {
231- /******/ __webpack_require__ . v = ( exports , wasmModuleId , wasmModuleHash , importsObj ) => {
232- /******/
233- /******/ var req = fetch ( __webpack_require__ . p + "" + wasmModuleHash + ".module.wasm" ) ;
234- /******/ var fallback = ( ) => ( req
235- /******/ . then ( ( x ) => ( x . arrayBuffer ( ) ) )
236- /******/ . then ( ( bytes ) => ( WebAssembly . instantiate ( bytes , importsObj ) ) )
237- /******/ . then ( ( res ) => ( Object . assign ( exports , res . instance . exports ) ) ) ) ;
238- /******/ return req . then ( ( res ) => {
239- /******/ if ( typeof WebAssembly . instantiateStreaming === "function" ) {
240- /******/
241- /******/ return WebAssembly . instantiateStreaming ( res , importsObj )
242- /******/ . then (
243- /******/ ( res ) => ( Object . assign ( exports , res . instance . exports ) ) ,
244- /******/ ( e ) => {
245- /******/ if ( res . headers . get ( "Content-Type" ) !== "application/wasm" ) {
246- /******/ console . warn ( "`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n" , e ) ;
247- /******/ return fallback ( ) ;
248- /******/ }
249- /******/ throw e ;
250- /******/ }
251- /******/ ) ;
252- /******/ }
253- /******/ return fallback ( ) ;
254- /******/ } ) ;
255- /******/ } ;
256- /******/ } ) ( ) ;
257- /******/
258190/******/ /* webpack/runtime/publicPath */
259191/******/ ( ( ) => {
260192/******/ var scriptUrl ;
0 commit comments