Skip to content

Commit

Permalink
code cleanup for uglifyjs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmtech committed May 1, 2017
1 parent 372cac7 commit 9c6ac20
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/core/inspector/graphs.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ InspectorGraphs.prototype.updateGraphs = function(stats, ignoreRefresh) {
ctx.fillRect(i*factorX, height -(value)*factorY, 1, 1);
}

if (this.showCursor == true) {
if (this.showCursor) {
index = (this.cursorIndex + samplesIndex) % samples;
str = '<span style="color:#555">&FilledSmallSquare;</span> Total: ' + Math.ceil((valuesMetatiles[index] + valuesResources[index] + valuesTextures[index] + valuesMeshes[index])/(1024*1024)) + 'MB' +
' &nbsp <span style="color:#000000">&FilledSmallSquare;</span> CPU: ' + Math.ceil(valuesResources[index]/(1024*1024)) + 'MB' +
Expand Down
2 changes: 1 addition & 1 deletion src/core/map/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ MapConfig.prototype.parseReferenceFrame = function() {

this.map.referenceFrame = new MapRefFrame(this.map, rf);

if (this.map.referenceFrame.valid == false) {
if (!this.map.referenceFrame.valid) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/map/draw-tiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ MapDrawTiles.prototype.drawGeodataTile = function(tile, node, cameraPos, pixelSi
/*
else if (tile.lastRenderState){
if (tile.surfaceGeodata.isReady(true, priority) == true) {
if (tile.surfaceGeodata.isReady(true, priority) {
if (tile.drawCommands[channel].length > 0) {
if (!preventRedener) {
this.draw.processDrawCommands(cameraPos, tile.lastRenderState.drawCommands[channel], priority, true);
Expand Down
4 changes: 2 additions & 2 deletions src/core/map/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ MapDraw.prototype.drawMap = function(skipFreeLayers) {

var projected = this.isProjected;

if (!projected) {
//if (!projected) {
//why calling this function distorts camera? why I have call it before update camera<
//var camInfo = this.measure.getPositionCameraInfo(this.position, this.getNavigationSrs().isProjected(), true); //
}
//}

var drawTiles = this.drawTiles;
var camInfo = camera.update();
Expand Down
6 changes: 3 additions & 3 deletions src/core/map/geodata-processor/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var MapGeodataProcessor = function(surface, listener) {

// eslint-disable-next-line
var worker = require('worker-loader?inline&fallback=false!./worker-main');
//var worker = require("worker-loader?inline!./worker-main");
//var worker = require('worker-loader?!./worker-main');

//debug worker
this.processWorker = new worker;
Expand All @@ -22,7 +22,7 @@ var MapGeodataProcessor = function(surface, listener) {


MapGeodataProcessor.prototype.kill = function() {
if (this.killed == true) {
if (this.killed) {
return;
}

Expand Down Expand Up @@ -68,7 +68,7 @@ MapGeodataProcessor.prototype.setListener = function(listener) {


MapGeodataProcessor.prototype.sendCommand = function(command, data, tile) {
if (this.killed == true) {
if (this.killed) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/map/geodata-processor/worker-linestring.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ var postGroupMessage = postGroupMessage_;


var processLineStringPass = function(lineString, lod, style, zIndex, eventInfo) {
var lines = lineString['lines'] || [];
var lines = (lineString['lines'] || lineString['d-lines']) || [];

if (lines.length == 0) {
return;
}

var dlines = (lineString['lines']) ? true : false;
var line = getLayerPropertyValue(style, 'line', lineString, lod);
var lineLabel = getLayerPropertyValue(style, 'line-label', lineString, lod);

Expand Down Expand Up @@ -140,7 +141,6 @@ var processLineStringPass = function(lineString, lod, style, zIndex, eventInfo)
var texturedLine = (lineStyle != 'solid');


var dlines = false;
var distance = 0.001;
var distance2 = 0.001;

Expand Down
14 changes: 7 additions & 7 deletions src/core/map/geodata-processor/worker-pointarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ var postGroupMessage = postGroupMessage_;

var processPointArrayPass = function(pointArray, lod, style, zIndex, eventInfo) {
var pointsGroups = [];
var i, li;
var i, li, dpoints = false;

if (pointArray['lines']) { //use lines as points
pointsGroups = pointArray['lines'] || [];
if (pointArray['lines'] || pointArray['d-lines']) { //use lines as points
pointsGroups = pointArray['lines'] || pointArray['d-lines'];
dpoints = (pointArray['d-lines']) ? true : false;
} else {
if (pointArray['points']) {
pointsGroups = [pointArray['points']];
if (pointArray['points'] || pointArray['d-points']) {
pointsGroups = [(pointArray['points'] || pointArray['d-points'])];
dpoints = (pointArray['d-points']) ? true : false;
}
}

Expand Down Expand Up @@ -159,8 +161,6 @@ var processPointArrayPass = function(pointArray, lod, style, zIndex, eventInfo)
vertexBuffer = new Array(points.length * pointsVertices);
}

var dpoints = false;

//add ponints
for (i = 0, li = points.length; i < li; i++) {

Expand Down
10 changes: 4 additions & 6 deletions src/core/map/geodata-processor/worker-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,7 @@ var processLayer = function(layerId, layerData, stylesheetLayersData) {


var processStylesheet = function(stylesheetLayersData) {

var key;

globals.stylesheetBitmaps = {};
globals.stylesheetConstants = stylesheetLayersData['constants'] || {};

Expand All @@ -781,7 +779,7 @@ var processStylesheet = function(stylesheetLayersData) {
//build map
for (key in bitmaps) {
var bitmap = bitmaps[key];
var skip = false;
//var skip = false;

if ((typeof bitmap) == 'string') {
bitmap = {'url':bitmap};
Expand All @@ -793,9 +791,9 @@ var processStylesheet = function(stylesheetLayersData) {
logError('wrong-bitmap', key);
}

if (!skip) {
globals.stylesheetBitmaps[key] = bitmap;
}
//if (!skip) {
globals.stylesheetBitmaps[key] = bitmap;
//}
}

//load bitmaps
Expand Down
2 changes: 1 addition & 1 deletion src/core/map/geodata.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ MapGeodata.prototype.killGeodata = function(killedByCache) {
this.geodata = null;
}

if (killedByCache != true && this.cacheItem != null) {
if (killedByCache !== true && this.cacheItem != null) {
this.map.resourcesCache.remove(this.cacheItem);
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ Map.prototype.hitTestGeoLayers = function(screenX, screenY, mode) {
this.dirty = true;
}

if (this.hoverFeature != null && this.hoverFeature[3] == true) {
if (this.hoverFeature != null && this.hoverFeature[3]) {
return [this.hoverFeature, true, relatedEvents];
} else {
return [null, false, relatedEvents];
Expand Down
2 changes: 1 addition & 1 deletion src/core/map/mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ MapMesh.prototype.onLoadError = function() {


MapMesh.prototype.onLoaded = function(data, task) {
if (this.map.killed == true){
if (this.map.killed){
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/map/stylesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ MapStylesheet.prototype.onLoadError = function() {


MapStylesheet.prototype.onLoaded = function(data) {
if (this.map.killed == true){
if (this.map.killed){
return;
}

Expand Down
16 changes: 8 additions & 8 deletions src/core/map/surface-tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ MapSurfaceTile.prototype.createVirtualMetanode = function(tree, priority) {
var alien = surfaces[i][1];
metatile = this.metaresources.getMetatile(surface, null, this);

if (metatile.isReady(priority) == true) {
if (metatile.isReady(priority)) {
metanode = metatile.getNode(this.id);

if (metanode != null) {
Expand Down Expand Up @@ -762,7 +762,7 @@ MapSurfaceTile.prototype.getPixelSize = function(bbox, screenPixelSize, cameraPo

//console.log("new: " + (factor * screenPixelSize) + " old:" + this.tilePixelSize2(node) );

if (returnDistance == true) {
if (returnDistance) {
return [(factor[0] * screenPixelSize), factor[1]];
}

Expand Down Expand Up @@ -1039,24 +1039,24 @@ MapSurfaceTile.prototype.drawGrid = function(cameraPos, divNode, angle) {
[ur[0], middle[1]]
];

var flatGrid = true, h, coordsRes, factor, prog;
var h, coordsRes, factor, prog;

if (fastGrid) {
if (!this.metanode) {
return;
}

if (flatGrid) {
/*if (flatGrid) {*/
//var h = this.metanode.minZ;
h = this.metanode.surrogatez;
h = this.metanode.surrogatez;

//if (this.map.drawLods) { h = this.metanode.minZ; }
coordsRes = [[h],[h],[h],[h],[h],[h],[h],[h]];
coordsRes = [[h],[h],[h],[h],[h],[h],[h],[h]];

//middle[2] = h;
//middle = node.getPhysicalCoords(middle, true);

} else {
/*} else {
var mnode = this.metanode;
Expand Down Expand Up @@ -1151,7 +1151,7 @@ MapSurfaceTile.prototype.drawGrid = function(cameraPos, divNode, angle) {
coordsRes[7] = [(border[5] + border[4]) * 0.5];
}
}
}*/



Expand Down
8 changes: 4 additions & 4 deletions src/core/map/surface-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ var MapSurfaceTree = function(map, freeLayer, freeLayerSurface) {

this.surfaceTree = new MapSurfaceTile(this.map, null, this.rootId);

if (freeLayer !== true) {
//if (freeLayer !== true) {
//this.heightTracer = new MapMetanodeTracer(this, null, this.traceTileHeight.bind(this), this.traceHeightChild.bind(this));
//this.heightTracerNodeOnly = new MapMetanodeTracer(this, null, this.traceTileHeightNodeOnly.bind(this), this.traceHeightChild.bind(this));
}
//}

this.surfaceSequence = [];
this.surfaceOnlySequence = [];
Expand Down Expand Up @@ -776,7 +776,7 @@ MapSurfaceTree.prototype.drawSurfaceFit = function() {
var lastProcessBufferIndex = newProcessBufferIndex;
var lastDrawBufferIndex = drawBufferIndex;

if (node.hasChildren() == false || tile.texelSize <= texelSizeFit) {
if (!node.hasChildren() || tile.texelSize <= texelSizeFit) {

priority = ((tile.id[0] + lodShift) * typeFactor) * tile.distance;

Expand Down Expand Up @@ -1122,7 +1122,7 @@ MapSurfaceTree.prototype.traceHeightTileByMap = function(tile, params) {
tile.heightMap = tile.resources.getTexture(path, true);
//}
} else {
if (tile.heightMap.isReady() == true) {
if (tile.heightMap.isReady()) {
params.parent = {
metanode : params.metanode,
heightMap : params.heightMap,
Expand Down
2 changes: 1 addition & 1 deletion src/core/renderer/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Camera.prototype.scaleFactor = function(worldPos, returnDist) {
// ('dist' is used instead of camera depth (camPos(2)) to make the tile
// resolution independent of camera rotation)

if (returnDist == true) {
if (returnDist) {
if (dist < this.near) return [Number.POSITIVEINFINITY, dist];
return [this.projection[0] / dist, dist];
//return [(this.projection[5]*0.5) / dist, dist]; //projection by sy
Expand Down
2 changes: 1 addition & 1 deletion src/core/renderer/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ RendererDraw.prototype.drawImage = function(x, y, lx, ly, texture, color, depth,
}

if (useState !== true) {
if (depthTest != true) {
if (depthTest !== true) {
gl.disable(gl.DEPTH_TEST);
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/renderer/gpu/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GpuProgram.prototype.createShader = function(source, vertexShader) {

var shader;

if (vertexShader != true) {
if (vertexShader !== true) {
shader = gl.createShader(gl.FRAGMENT_SHADER);
} else {
shader = gl.createShader(gl.VERTEX_SHADER);
Expand Down
2 changes: 1 addition & 1 deletion src/core/renderer/gpu/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ GpuText.prototype.compile = function() {
//this.core.renderer.statsFluxMesh[0][1] += this.size;
}

if (this.withNormals == true) {
if (this.withNormals) {
this.normals = [];
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/core/renderer/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ var Renderer = function(core, div, onUpdate, onResize, config) {

//intit resources
// eslint-disable-next-line
var init = new RenderInit(this);
this.init = new RenderInit(this);
this.draw = new RenderDraw(this);

//if (window["MelMobile"] && this.gpu.canvas != null) {
Expand Down

0 comments on commit 9c6ac20

Please sign in to comment.