summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/engine/map/tools/start.js
blob: cca387c69ce54b626cd8a8d8d64efe5ec87b323d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// This tool is used to set the start position on the map.

var StartPositionTool = MapTool.extend(function(base){
	var exports = {}
	
	var selected_point = null
	
	var line = exports.line = []
	
	var can_drag, dragging
	
	exports.down = function(e, cursor){
    // rightclick?
    if (e.ctrlKey || e.which === 3) {
      cursor.quantize(1/map.zoom)
      app.router.blueprintView.map.center.a = cursor.x.a
      app.router.blueprintView.map.center.b = -cursor.y.a
      cursor.x.b = cursor.x.a
      cursor.y.b = cursor.y.a
      return
    }
    
    cam.x = app.controller.startPosition.x = cursor.x.a
    cam.z = app.controller.startPosition.z = cursor.y.a
	}
	
	return exports
	
})