Skip to content

Commit

Permalink
expose demo instance externally
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Jan 14, 2016
1 parent 1a55259 commit a9122ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">&middot;</span> <a href="http://brm.io/matter-js/">Project page</a> <span class="nav-sep">&middot;</span> <a href="https://github.com/liabru/matter-js">GitHub</a> <span class="nav-sep">&middot;</span> <a href="http://twitter.com/liabru">@liabru</a></p>
<div class="controls-container">
<select id="demo-select">
Expand Down
12 changes: 10 additions & 2 deletions demo/js/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
Expand All @@ -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);
});
};
Expand Down

0 comments on commit a9122ed

Please sign in to comment.