diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-08-17 16:27:40 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-08-17 17:25:28 -0400 |
| commit | 3c36de54b57422f34c367934fdf62873b881fa20 (patch) | |
| tree | 19d39fdae8d0372a2c0c682de4b09f69d72045a1 /public/assets/javascripts/ui/blueprint/BlueprintToolbar.js | |
| parent | 599b43df07f092b35d25e7adac11db3c3b3d9c76 (diff) | |
integrate ortho3 stuff into blueprint views
Diffstat (limited to 'public/assets/javascripts/ui/blueprint/BlueprintToolbar.js')
| -rw-r--r-- | public/assets/javascripts/ui/blueprint/BlueprintToolbar.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/public/assets/javascripts/ui/blueprint/BlueprintToolbar.js b/public/assets/javascripts/ui/blueprint/BlueprintToolbar.js new file mode 100644 index 0000000..69288f6 --- /dev/null +++ b/public/assets/javascripts/ui/blueprint/BlueprintToolbar.js @@ -0,0 +1,69 @@ +var BlueprintToolbar = View.extend({ + + el: "#blueprintToolbar", + + events: { + "click [data-role=toggle-orbit-mode]": 'toggleOrbitMode', + "click [data-role=arrow-mode]": 'arrowMode', + "click [data-role=polyline-mode]": 'polylineMode', + "click [data-role=ortho-polyline-mode]": 'orthoPolylineMode', + "click [data-role=eraser-mode]": 'eraserMode', + }, + + initialize: function(opt){ + this.parent = opt.parent + + this.$modes = this.$('.mode') + this.$arrowMode = this.$('[data-role=arrow-mode]') + this.$polylineMode = this.$('[data-role=polyline-mode]') + this.$orthoPolylineMode = this.$('[data-role=ortho-polyline-mode]') + this.$eraserMode = this.$('[data-role=eraser-mode]') + + this.orthoPolylineMode() + }, + + orbiting: true, + toggleOrbitMode: function(){ + this.orbiting = ! this.orbiting + if (this.orbiting) { + controls.toggle(true) + movements.lock() + } + else { + controls.toggle(false) + movements.unlock() + movements.gravity(true) + cam.rotationX = 0 + cam.rotationY = -cam.rotationY + cam.x = 0 + cam.y = viewHeight + cam.z = 0 + } + }, + + setActiveMode: function( $el ) { + this.$modes.removeClass('active') + $el.addClass('active') + }, + + arrowMode: function(){ + this.setActiveMode( this.$arrowMode ) + this.parent.map.ui.set_tool("arrow") + }, + + polylineMode: function(){ + this.setActiveMode( this.$polylineMode ) + this.parent.map.ui.set_tool("polyline") + }, + + orthoPolylineMode: function(){ + this.setActiveMode( this.$orthoPolylineMode ) + this.parent.map.ui.set_tool("ortho-polyline") + }, + + eraserMode: function(){ + this.setActiveMode( this.$eraserMode ) + this.parent.map.ui.set_tool("eraser") + }, + +})
\ No newline at end of file |
