Added option to fix prev thing
This commit is contained in:
parent
e67896341f
commit
c2f971f9e9
|
@ -114,6 +114,9 @@ block content
|
|||
input#showarrows(type="checkbox", style={'margin-right': '10px', 'margin-bottom': '10px'}, checked)
|
||||
label(for="showarrows" style={'margin-right':'10px'}) Show arrows
|
||||
|
||||
input#recommendation(type="checkbox", style={'margin-right': '10px', 'margin-bottom': '10px'})
|
||||
label(for="recommendation" style={'margin-right':'10px'}) Fixed prev
|
||||
|
||||
audio#music(controls, volume=0.5)
|
||||
source(src="/static/data/music/bobomb.ogg")
|
||||
source(src="/static/data/music/bobomb.mp3")
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
var ButtonManager = function(cameras) {
|
||||
var ButtonManager = function(cameras, previewer) {
|
||||
this.cameras = cameras;
|
||||
this.previewer = previewer;
|
||||
|
||||
this.showArrows = true;
|
||||
this.beenFullscreen = false;
|
||||
|
@ -13,6 +14,8 @@ var ButtonManager = function(cameras) {
|
|||
this.collisionElement = document.getElementById('collisions');
|
||||
this.showarrowsElement = document.getElementById('showarrows');
|
||||
|
||||
this.recommendationElement = document.getElementById('recommendation');
|
||||
|
||||
this.fullscreenElement.onclick = function() {fullscreen();};
|
||||
|
||||
(function(self) {
|
||||
|
@ -31,6 +34,10 @@ var ButtonManager = function(cameras) {
|
|||
self.collisionElement.onchange = function() {self.cameras.mainCamera().collisions = self.collisionElement.checked;}
|
||||
self.showarrowsElement.onchange = function() {self.showArrows = self.showarrowsElement.checked;}
|
||||
self.resetElement.onclick = function() {self.cameras.mainCamera().reset();}
|
||||
|
||||
self.recommendationElement.onchange = function() {
|
||||
previewer.fixedRecommendation(self.recommendationElement.checked);
|
||||
}
|
||||
})(this);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,20 +2,22 @@ var Previewer = function(renderer) {
|
|||
this.domElement = document.createElement('canvas');
|
||||
this.ctx = this.domElement.getContext('2d');
|
||||
this.renderer = renderer;
|
||||
this.fixed = false;
|
||||
}
|
||||
|
||||
Previewer.prototype.render = function(prev, container_width, container_height) {
|
||||
var width = container_width / 5;
|
||||
var height = container_height / 5;
|
||||
var left = prev.x - width/2;
|
||||
var bottom = renderer.domElement.height - prev.y + height/5;
|
||||
var width, height, left, bottom;
|
||||
|
||||
if (prev.go) {
|
||||
width = Math.floor(container_width / 5);
|
||||
height = Math.floor(container_height / 5);
|
||||
if (!this.fixed) {
|
||||
left = Math.floor(prev.x - width/2);
|
||||
bottom = Math.floor(renderer.domElement.height - prev.y + height/5);
|
||||
|
||||
bottom = Math.floor(this.renderer.domElement.height - prev.y + height/5);
|
||||
} else {
|
||||
left = 0;
|
||||
bottom = 0;
|
||||
}
|
||||
|
||||
// Draw border
|
||||
var can_bottom = container_height - bottom - height ;
|
||||
|
@ -54,3 +56,7 @@ Previewer.prototype.clear = function() {
|
|||
this.clearNeeded = false;
|
||||
}
|
||||
}
|
||||
|
||||
Previewer.prototype.fixedRecommendation = function(bool) {
|
||||
this.fixed = bool;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ function initListeners() {
|
|||
document.addEventListener('keydown', function(event) { if (event.keyCode == 27) { stopFullscreen();} }, false);
|
||||
|
||||
// HTML Bootstrap buttons
|
||||
buttonManager = new ButtonManager(cameras);
|
||||
buttonManager = new ButtonManager(cameras, previewer);
|
||||
|
||||
// Camera selecter for hover and clicking recommendations
|
||||
cameraSelecter = new CameraSelecter(renderer, cameras, buttonManager);
|
||||
|
|
Loading…
Reference in New Issue