83 lines
2.7 KiB
Text
83 lines
2.7 KiB
Text
// TODO document this user agent function
|
|
var labelType, useGradients, nativeTextSupport, animate
|
|
;(function () {
|
|
var ua = navigator.userAgent,
|
|
iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i),
|
|
typeOfCanvas = typeof HTMLCanvasElement,
|
|
nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'),
|
|
textSupport = nativeCanvasSupport && (typeof document.createElement('canvas').getContext('2d').fillText == 'function')
|
|
// I'm setting this based on the fact that ExCanvas provides text support for IE
|
|
// and that as of today iPhone/iPad current text support is lame
|
|
labelType = (!nativeCanvasSupport || (textSupport && !iStuff)) ? 'Native' : 'HTML'
|
|
nativeTextSupport = labelType == 'Native'
|
|
useGradients = nativeCanvasSupport
|
|
animate = !(iStuff || !nativeCanvasSupport)
|
|
})()
|
|
|
|
// TODO eliminate these 5 top-level variables
|
|
Metamaps.panningInt = null
|
|
Metamaps.tempNode = null
|
|
Metamaps.tempInit = false
|
|
Metamaps.tempNode2 = null
|
|
Metamaps.VERSION = '<%= METAMAPS_VERSION %>'
|
|
|
|
/* 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') %>'
|
|
|
|
Metamaps.Settings = {
|
|
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'
|
|
}
|
|
},
|
|
}
|
|
|
|
Metamaps.Touch = {
|
|
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
|
|
}
|
|
|
|
Metamaps.Mouse = {
|
|
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
|
|
}
|
|
|
|
Metamaps.Selected = {
|
|
reset: function () {
|
|
var self = Metamaps.Selected
|
|
|
|
self.Nodes = []
|
|
self.Edges = []
|
|
},
|
|
Nodes: [],
|
|
Edges: []
|
|
}
|