mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-23 09:26:51 -05:00
expose demo instance externally
This commit is contained in:
parent
1a55259ba7
commit
a9122ed488
2 changed files with 12 additions and 4 deletions
|
@ -26,11 +26,11 @@
|
|||
<script type="text/javascript" src="./js/Examples.js"></script>
|
||||
<script type="text/javascript" src="./js/Demo.js"></script>
|
||||
|
||||
<title>Matter.js Demo (Edge Build)</title>
|
||||
<title>Matter.js Demo</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Matter.js Demo (Edge Build)</h1>
|
||||
<h1>Matter.js Demo</h1>
|
||||
<p class="nav nav-links"><a href="./mobile.html">Mobile Demo</a> <span class="nav-sep">·</span> <a href="http://brm.io/matter-js/">Project page</a> <span class="nav-sep">·</span> <a href="https://github.com/liabru/matter-js">GitHub</a> <span class="nav-sep">·</span> <a href="http://twitter.com/liabru">@liabru</a></p>
|
||||
<div class="controls-container">
|
||||
<select id="demo-select">
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
|
||||
Demo.init = function() {
|
||||
var demo = Demo.create();
|
||||
Matter.Demo._demo = demo;
|
||||
|
||||
// get container element for the canvas
|
||||
demo.container = document.getElementById('canvas-container');
|
||||
|
@ -193,7 +194,10 @@
|
|||
demoSelect.addEventListener('change', function(e) {
|
||||
Demo.reset(demo);
|
||||
Demo.setScene(demo,demo.sceneName = e.target.value);
|
||||
Gui.update(demo.gui);
|
||||
|
||||
if (demo.gui) {
|
||||
Gui.update(demo.gui);
|
||||
}
|
||||
|
||||
var scrollY = window.scrollY;
|
||||
window.location.hash = demo.sceneName;
|
||||
|
@ -204,7 +208,11 @@
|
|||
demoReset.addEventListener('click', function(e) {
|
||||
Demo.reset(demo);
|
||||
Demo.setScene(demo, demo.sceneName);
|
||||
Gui.update(demo.gui);
|
||||
|
||||
if (demo.gui) {
|
||||
Gui.update(demo.gui);
|
||||
}
|
||||
|
||||
Demo.setUpdateSourceLink(demo.sceneName);
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue