make Util modular
This commit is contained in:
parent
7f83f86460
commit
d97b5c2977
1 changed files with 5 additions and 12 deletions
|
@ -1,11 +1,4 @@
|
||||||
/* global Metamaps */
|
import Visualize from './Visualize'
|
||||||
|
|
||||||
/*
|
|
||||||
* Metamaps.Util.js
|
|
||||||
*
|
|
||||||
* Dependencies:
|
|
||||||
* - Metamaps.Visualize
|
|
||||||
*/
|
|
||||||
|
|
||||||
const Util = {
|
const Util = {
|
||||||
// helper function to determine how many lines are needed
|
// helper function to determine how many lines are needed
|
||||||
|
@ -45,8 +38,8 @@ const Util = {
|
||||||
return Math.sqrt(Math.pow((p2.x - p1.x), 2) + Math.pow((p2.y - p1.y), 2))
|
return Math.sqrt(Math.pow((p2.x - p1.x), 2) + Math.pow((p2.y - p1.y), 2))
|
||||||
},
|
},
|
||||||
coordsToPixels: function (coords) {
|
coordsToPixels: function (coords) {
|
||||||
if (Metamaps.Visualize.mGraph) {
|
if (Visualize.mGraph) {
|
||||||
var canvas = Metamaps.Visualize.mGraph.canvas,
|
var canvas = Visualize.mGraph.canvas,
|
||||||
s = canvas.getSize(),
|
s = canvas.getSize(),
|
||||||
p = canvas.getPos(),
|
p = canvas.getPos(),
|
||||||
ox = canvas.translateOffsetX,
|
ox = canvas.translateOffsetX,
|
||||||
|
@ -67,8 +60,8 @@ const Util = {
|
||||||
},
|
},
|
||||||
pixelsToCoords: function (pixels) {
|
pixelsToCoords: function (pixels) {
|
||||||
var coords
|
var coords
|
||||||
if (Metamaps.Visualize.mGraph) {
|
if (Visualize.mGraph) {
|
||||||
var canvas = Metamaps.Visualize.mGraph.canvas,
|
var canvas = Visualize.mGraph.canvas,
|
||||||
s = canvas.getSize(),
|
s = canvas.getSize(),
|
||||||
p = canvas.getPos(),
|
p = canvas.getPos(),
|
||||||
ox = canvas.translateOffsetX,
|
ox = canvas.translateOffsetX,
|
||||||
|
|
Loading…
Reference in a new issue