summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/engine/map/ui_minimap.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-07-21 13:23:22 -0400
committerJules Laplace <jules@okfoc.us>2015-07-21 13:23:22 -0400
commit44642b48203b3ee2fa9e281f31ed9fed3f60ee79 (patch)
tree2a08c83ab4aad41274cd1c9ace91753a250a6e6d /public/assets/javascripts/rectangles/engine/map/ui_minimap.js
parentc6a22d43e82d989e73d1be9894c1c9ae9446033d (diff)
find closest segment
Diffstat (limited to 'public/assets/javascripts/rectangles/engine/map/ui_minimap.js')
-rw-r--r--public/assets/javascripts/rectangles/engine/map/ui_minimap.js81
1 files changed, 0 insertions, 81 deletions
diff --git a/public/assets/javascripts/rectangles/engine/map/ui_minimap.js b/public/assets/javascripts/rectangles/engine/map/ui_minimap.js
deleted file mode 100644
index 0fdd336..0000000
--- a/public/assets/javascripts/rectangles/engine/map/ui_minimap.js
+++ /dev/null
@@ -1,81 +0,0 @@
-
-Map.UI = Map.UI || {}
-
-Map.UI.Minimap = function(map){
-
- var base = this
-
- base.creating = base.dragging = base.resizing = false
-
- base.mouse = new mouse({
- el: map.el,
- down: down,
- move: move,
- drag: drag,
- up: up,
- rightclick: rightclick,
- })
-
- base.wheel = new wheel({
- el: map.el,
- update: mousewheel,
- })
-
- var x, z
-
- //
-
- function down (e, cursor){
- cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a)
- cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b)
-
- x = scene.camera.x
- z = scene.camera.z
-
- if (e.ctrlKey || e.which === 3) {
- cursor.quantize(1/map.zoom)
- map.center.a = cursor.x.a
- map.center.b = -cursor.y.a
- console.log(map.center+"")
- cursor.x.b = cursor.x.a
- cursor.y.b = cursor.y.a
- base.mouse.down = false
- e.preventDefault()
- e.stopPropagation()
- return
- }
- }
-
- function move (e, cursor) {
- cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a)
- cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b)
- }
-
- function drag (e, cursor) {
- cursor.x.b = ((cursor.x.b/map.dimensions.a)+0.5) * map.dimensions.a / map.zoom + map.center.a
- cursor.y.b = ((cursor.y.b/map.dimensions.b)-0.5) * map.dimensions.b / map.zoom - map.center.b
-
- scene.camera.x = x + cursor.x.magnitude() * map.zoom * 16
- scene.camera.z = z + cursor.y.magnitude() * map.zoom * 16
- Rooms.mover.room = null
-
- if (base.dragging) {
- base.dragging.rect.translation.a = cursor.x.magnitude()
- base.dragging.rect.translation.b = cursor.y.magnitude()
- }
- }
-
- function up (e, cursor, new_cursor) {
- new_cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a)
- new_cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b)
-
- base.dragging = false
- }
-
- function mousewheel (e, deltaY, deltaX){
- map.set_zoom(map.zoom_exponent - deltaY/20)
- }
-
- function rightclick (e){
- }
-}