2016-04-24 15:50:35 +00:00
|
|
|
/* global Metamaps */
|
2016-02-23 11:04:39 +00:00
|
|
|
|
2016-04-24 15:50:35 +00:00
|
|
|
/*
|
|
|
|
* Metamaps.js.erb
|
|
|
|
*/
|
2016-02-03 13:38:41 +00:00
|
|
|
|
2016-04-06 02:27:31 +00:00
|
|
|
// TODO eliminate these 5 top-level variables
|
2016-04-24 15:50:35 +00:00
|
|
|
Metamaps.panningInt = null
|
|
|
|
Metamaps.tempNode = null
|
|
|
|
Metamaps.tempInit = false
|
|
|
|
Metamaps.tempNode2 = null
|
2016-04-13 02:48:34 +00:00
|
|
|
Metamaps.VERSION = '<%= METAMAPS_VERSION %>'
|
2016-02-03 13:38:41 +00:00
|
|
|
|
2016-04-24 15:50:35 +00:00
|
|
|
/* erb variables from rails */
|
|
|
|
Metamaps.Erb = {}
|
|
|
|
Metamaps.Erb['REALTIME_SERVER'] = '<%= ENV['REALTIME_SERVER'] %>'
|
|
|
|
Metamaps.Erb['junto_spinner_darkgrey.gif'] = '<%= asset_path('junto_spinner_darkgrey.gif') %>'
|
|
|
|
Metamaps.Erb['user.png'] = '<%= asset_path('user.png') %>'
|
|
|
|
Metamaps.Erb['icons/wildcard.png'] = '<%= asset_path('icons/wildcard.png') %>'
|
|
|
|
Metamaps.Erb['topic_description_signifier.png'] = '<%= asset_path('topic_description_signifier.png') %>'
|
|
|
|
Metamaps.Erb['topic_link_signifier.png'] = '<%= asset_path('topic_link_signifier.png') %>'
|
|
|
|
Metamaps.Erb['synapse16.png'] = '<%= asset_path('synapse16.png') %>'
|
2016-08-03 00:54:10 +00:00
|
|
|
Metamaps.Metacodes = <%= Metacode.all.to_json.gsub(%r[(icon.*?)(\"},)], '\1?purple=stupid\2').html_safe %>
|
2016-04-24 15:50:35 +00:00
|
|
|
|
2016-02-03 13:38:41 +00:00
|
|
|
Metamaps.Settings = {
|
2016-04-24 15:50:35 +00:00
|
|
|
embed: false, // indicates that the app is on a page that is optimized for embedding in iFrames on other web pages
|
|
|
|
sandbox: false, // puts the app into a mode (when true) where it only creates data locally, and isn't writing it to the database
|
|
|
|
colors: {
|
|
|
|
background: '#344A58',
|
|
|
|
synapses: {
|
|
|
|
normal: '#888888',
|
|
|
|
hover: '#888888',
|
|
|
|
selected: '#FFFFFF'
|
|
|
|
},
|
|
|
|
topics: {
|
|
|
|
selected: '#FFFFFF'
|
|
|
|
},
|
|
|
|
labels: {
|
|
|
|
background: '#18202E',
|
|
|
|
text: '#DDD'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
2016-02-03 13:38:41 +00:00
|
|
|
|
|
|
|
Metamaps.Touch = {
|
2016-04-24 15:50:35 +00:00
|
|
|
touchPos: null, // this stores the x and y values of a current touch event
|
|
|
|
touchDragNode: null // this stores a reference to a JIT node that is being dragged
|
|
|
|
}
|
2016-02-03 13:38:41 +00:00
|
|
|
|
|
|
|
Metamaps.Mouse = {
|
2016-04-24 15:50:35 +00:00
|
|
|
didPan: false,
|
|
|
|
didBoxZoom: false,
|
|
|
|
changeInX: 0,
|
|
|
|
changeInY: 0,
|
|
|
|
edgeHoveringOver: false,
|
|
|
|
boxStartCoordinates: false,
|
|
|
|
boxEndCoordinates: false,
|
|
|
|
synapseStartCoordinates: [],
|
|
|
|
synapseEndCoordinates: null,
|
|
|
|
lastNodeClick: 0,
|
|
|
|
lastCanvasClick: 0,
|
|
|
|
DOUBLE_CLICK_TOLERANCE: 300
|
|
|
|
}
|
2016-02-03 13:38:41 +00:00
|
|
|
|
|
|
|
Metamaps.Selected = {
|
2016-04-24 15:50:35 +00:00
|
|
|
reset: function () {
|
|
|
|
var self = Metamaps.Selected
|
|
|
|
|
|
|
|
self.Nodes = []
|
|
|
|
self.Edges = []
|
|
|
|
},
|
|
|
|
Nodes: [],
|
|
|
|
Edges: []
|
|
|
|
}
|