From e5660ac75464ab820497eda326114615976aba8a Mon Sep 17 00:00:00 2001 From: Joshua Rodriguez Date: Tue, 14 Jan 2020 07:40:07 -0800 Subject: [PATCH] spaces -> tabs --- .../src/main/webroot/js/libs/Controls.js | 10 +- BlueMapCore/src/main/webroot/js/libs/Tile.js | 50 +++---- .../src/main/webroot/js/libs/bluemap.js | 16 +-- .../main/webroot/js/libs/modules/Compass.js | 34 ++--- .../src/main/webroot/js/libs/modules/Info.js | 36 ++--- .../main/webroot/js/libs/modules/MapMenu.js | 52 +++---- .../main/webroot/js/libs/modules/Module.js | 20 +-- .../main/webroot/js/libs/modules/Position.js | 28 ++-- .../main/webroot/js/libs/modules/Settings.js | 136 +++++++++--------- 9 files changed, 191 insertions(+), 191 deletions(-) diff --git a/BlueMapCore/src/main/webroot/js/libs/Controls.js b/BlueMapCore/src/main/webroot/js/libs/Controls.js index 7fd9748a..4008accb 100644 --- a/BlueMapCore/src/main/webroot/js/libs/Controls.js +++ b/BlueMapCore/src/main/webroot/js/libs/Controls.js @@ -24,11 +24,11 @@ */ import $ from 'jquery'; import { - Euler, - Raycaster, - Vector2, - Vector3, - MOUSE + Euler, + Raycaster, + Vector2, + Vector3, + MOUSE } from 'three'; import { Vector2_ZERO } from './utils.js'; diff --git a/BlueMapCore/src/main/webroot/js/libs/Tile.js b/BlueMapCore/src/main/webroot/js/libs/Tile.js index 6bcc7e24..5606ebd0 100644 --- a/BlueMapCore/src/main/webroot/js/libs/Tile.js +++ b/BlueMapCore/src/main/webroot/js/libs/Tile.js @@ -24,36 +24,36 @@ */ export default class Tile { - isLoading = false; - disposed = false; - model = null; + isLoading = false; + disposed = false; + model = null; - constructor(scene, x, z) { - this.scene = scene; - this.x = x; - this.z = z; - } + constructor(scene, x, z) { + this.scene = scene; + this.x = x; + this.z = z; + } - setModel(model) { - this.disposeModel(); + setModel(model) { + this.disposeModel(); - if (model) { - this.model = model; - this.scene.add(model); + if (model) { + this.model = model; + this.scene.add(model); - //console.log("Added tile:", this.x, this.z); - } - } + //console.log("Added tile:", this.x, this.z); + } + } - disposeModel() { - this.disposed = true; + disposeModel() { + this.disposed = true; - if (this.model) { - this.scene.remove(this.model); - this.model.geometry.dispose(); - delete this.model; + if (this.model) { + this.scene.remove(this.model); + this.model.geometry.dispose(); + delete this.model; - //console.log("Removed tile:", this.x, this.z); - } - } + //console.log("Removed tile:", this.x, this.z); + } + } } diff --git a/BlueMapCore/src/main/webroot/js/libs/bluemap.js b/BlueMapCore/src/main/webroot/js/libs/bluemap.js index 91e7247e..552417c8 100644 --- a/BlueMapCore/src/main/webroot/js/libs/bluemap.js +++ b/BlueMapCore/src/main/webroot/js/libs/bluemap.js @@ -25,22 +25,22 @@ import $ from 'jquery'; import { AmbientLight, - BackSide, - BufferGeometryLoader, - ClampToEdgeWrapping, - CubeGeometry, - DirectionalLight, + BackSide, + BufferGeometryLoader, + ClampToEdgeWrapping, + CubeGeometry, + DirectionalLight, FileLoader, FrontSide, Mesh, MeshBasicMaterial, MeshLambertMaterial, NormalBlending, - NearestFilter, - PerspectiveCamera, + NearestFilter, + PerspectiveCamera, Scene, Texture, - TextureLoader, + TextureLoader, VertexColors, WebGLRenderer, } from 'three'; diff --git a/BlueMapCore/src/main/webroot/js/libs/modules/Compass.js b/BlueMapCore/src/main/webroot/js/libs/modules/Compass.js index 6e60cdc0..4121be0c 100644 --- a/BlueMapCore/src/main/webroot/js/libs/modules/Compass.js +++ b/BlueMapCore/src/main/webroot/js/libs/modules/Compass.js @@ -29,25 +29,25 @@ import { getTopLeftElement } from './Module.js'; import COMPASS from '../../../assets/compass.svg'; export default class Compass { - constructor(blueMap) { - this.blueMap = blueMap; + constructor(blueMap) { + this.blueMap = blueMap; - $('#bluemap-compass').remove(); - this.element = $(`
`).appendTo(getTopLeftElement(blueMap)); - this.needle = $('#bluemap-compass-needle'); + $('#bluemap-compass').remove(); + this.element = $(`
`).appendTo(getTopLeftElement(blueMap)); + this.needle = $('#bluemap-compass-needle'); - $(document).on('bluemap-update-frame', this.onBlueMapUpdateFrame); - $(this.element).click(this.onClick); - } + $(document).on('bluemap-update-frame', this.onBlueMapUpdateFrame); + $(this.element).click(this.onClick); + } - onBlueMapUpdateFrame = () => { - this.needle.css('transform', `rotate(${this.blueMap.controls.direction}rad)`); - } + onBlueMapUpdateFrame = () => { + this.needle.css('transform', `rotate(${this.blueMap.controls.direction}rad)`); + } - onClick = () => { - this.blueMap.controls.targetDirection = 0; - this.blueMap.controls.direction = this.blueMap.controls.direction % (Math.PI * 2); - if (this.blueMap.controls.direction < -Math.PI) this.blueMap.controls.direction += Math.PI * 2; - if (this.blueMap.controls.direction > Math.PI) this.blueMap.controls.direction -= Math.PI * 2; - } + onClick = () => { + this.blueMap.controls.targetDirection = 0; + this.blueMap.controls.direction = this.blueMap.controls.direction % (Math.PI * 2); + if (this.blueMap.controls.direction < -Math.PI) this.blueMap.controls.direction += Math.PI * 2; + if (this.blueMap.controls.direction > Math.PI) this.blueMap.controls.direction -= Math.PI * 2; + } } diff --git a/BlueMapCore/src/main/webroot/js/libs/modules/Info.js b/BlueMapCore/src/main/webroot/js/libs/modules/Info.js index 19816d7c..b380d866 100644 --- a/BlueMapCore/src/main/webroot/js/libs/modules/Info.js +++ b/BlueMapCore/src/main/webroot/js/libs/modules/Info.js @@ -27,23 +27,23 @@ import $ from 'jquery'; import { getTopRightElement } from './Module.js'; export default class Info { - constructor(blueMap) { - this.blueMap = blueMap; - const parent = getTopRightElement(blueMap); - $('#bluemap-info').remove(); - this.elementInfo = $('
').appendTo(parent); - this.elementInfo.click(this.onClick); - } + constructor(blueMap) { + this.blueMap = blueMap; + const parent = getTopRightElement(blueMap); + $('#bluemap-info').remove(); + this.elementInfo = $('
').appendTo(parent); + this.elementInfo.click(this.onClick); + } - onClick = () => { - this.blueMap.alert( - '

Info

' + - 'Visit BlueMap on GitHub!
' + - 'BlueMap works best with Chrome.
' + - '

Controls

' + - 'Leftclick-drag with your mouse or use the arrow-keys to navigate.
' + - 'Rightclick-drag with your mouse to rotate your view.
' + - 'Scroll to zoom.
' - ); - } + onClick = () => { + this.blueMap.alert( + '

Info

' + + 'Visit BlueMap on GitHub!
' + + 'BlueMap works best with Chrome.
' + + '

Controls

' + + 'Leftclick-drag with your mouse or use the arrow-keys to navigate.
' + + 'Rightclick-drag with your mouse to rotate your view.
' + + 'Scroll to zoom.
' + ); + } } diff --git a/BlueMapCore/src/main/webroot/js/libs/modules/MapMenu.js b/BlueMapCore/src/main/webroot/js/libs/modules/MapMenu.js index 3bf3fcfe..18efe69e 100644 --- a/BlueMapCore/src/main/webroot/js/libs/modules/MapMenu.js +++ b/BlueMapCore/src/main/webroot/js/libs/modules/MapMenu.js @@ -27,37 +27,37 @@ import $ from 'jquery'; import { getTopLeftElement } from './Module.js'; export default class MapMenu { - constructor(blueMap) { - this.bluemap = blueMap; - const maps = this.bluemap.settings; + constructor(blueMap) { + this.bluemap = blueMap; + const maps = this.bluemap.settings; - $('#bluemap-mapmenu').remove(); - this.element = $(``).appendTo(getTopLeftElement(blueMap)); + $('#bluemap-mapmenu').remove(); + this.element = $(``).appendTo(getTopLeftElement(blueMap)); - const dropdown = $('').appendTo(this.element); - this.maplist = $('').appendTo(dropdown); + const dropdown = $('').appendTo(this.element); + this.maplist = $('').appendTo(dropdown); - for (let mapId in maps) { - if (!maps.hasOwnProperty(mapId)) continue; - if (!maps.enabled) continue; + for (let mapId in maps) { + if (!maps.hasOwnProperty(mapId)) continue; + if (!maps.enabled) continue; - const map = maps[mapId]; - $(`
  • ${map.name}
  • `).appendTo(this.maplist); - } + const map = maps[mapId]; + $(`
  • ${map.name}
  • `).appendTo(this.maplist); + } - this.maplist.find('li[map=' + this.bluemap.map + ']').hide(); - this.maplist.find('li[map]').click(this.onMapClick); - $(document).on('bluemap-map-change', this.onBlueMapMapChange); - } + this.maplist.find('li[map=' + this.bluemap.map + ']').hide(); + this.maplist.find('li[map]').click(this.onMapClick); + $(document).on('bluemap-map-change', this.onBlueMapMapChange); + } - onMapClick = event => { - const map = $(this).attr('map'); - this.bluemap.changeMap(map); - } + onMapClick = event => { + const map = $(this).attr('map'); + this.bluemap.changeMap(map); + } - onBlueMapMapChange = () => { - this.maplist.find('li').show(); - this.maplist.find('li[map=' + this.bluemap.map + ']').hide(); - this.element.find('.selection').html(this.bluemap.settings[this.bluemap.map].name); - } + onBlueMapMapChange = () => { + this.maplist.find('li').show(); + this.maplist.find('li[map=' + this.bluemap.map + ']').hide(); + this.element.find('.selection').html(this.bluemap.settings[this.bluemap.map].name); + } } diff --git a/BlueMapCore/src/main/webroot/js/libs/modules/Module.js b/BlueMapCore/src/main/webroot/js/libs/modules/Module.js index 390c9812..36c0fd0e 100644 --- a/BlueMapCore/src/main/webroot/js/libs/modules/Module.js +++ b/BlueMapCore/src/main/webroot/js/libs/modules/Module.js @@ -27,21 +27,21 @@ import $ from 'jquery'; // ###### Modules ###### export const getTopRightElement = blueMap => { - let element = $('#bluemap-topright'); + let element = $('#bluemap-topright'); - if (element.length === 0){ - element = $('
    ').appendTo(blueMap.element); - } + if (element.length === 0){ + element = $('
    ').appendTo(blueMap.element); + } - return element; + return element; }; export const getTopLeftElement = blueMap => { - let element = $('#bluemap-topleft'); + let element = $('#bluemap-topleft'); - if (element.length === 0){ - element = $('
    ').appendTo(blueMap.element); - } + if (element.length === 0){ + element = $('
    ').appendTo(blueMap.element); + } - return element; + return element; }; diff --git a/BlueMapCore/src/main/webroot/js/libs/modules/Position.js b/BlueMapCore/src/main/webroot/js/libs/modules/Position.js index 95d2cda0..1e951e1b 100644 --- a/BlueMapCore/src/main/webroot/js/libs/modules/Position.js +++ b/BlueMapCore/src/main/webroot/js/libs/modules/Position.js @@ -27,21 +27,21 @@ import $ from 'jquery'; import { getTopLeftElement } from './Module.js'; export default class Position { - constructor(blueMap) { - this.blueMap = blueMap; - const parent = getTopLeftElement(blueMap); + constructor(blueMap) { + this.blueMap = blueMap; + const parent = getTopLeftElement(blueMap); - $('.bluemap-position').remove(); - this.elementX = $('
    0
    ').appendTo(parent); - //this.elementY = $('
    0
    ').appendTo(parent); - this.elementZ = $('
    0
    ').appendTo(parent); + $('.bluemap-position').remove(); + this.elementX = $('
    0
    ').appendTo(parent); + //this.elementY = $('
    0
    ').appendTo(parent); + this.elementZ = $('
    0
    ').appendTo(parent); - $(document).on('bluemap-update-frame', this.onBlueMapUpdateFrame); - } + $(document).on('bluemap-update-frame', this.onBlueMapUpdateFrame); + } - onBlueMapUpdateFrame = () => { - this.elementX.html(Math.floor(this.blueMap.controls.targetPosition.x)); - //this.elementY.html(this.blueMap.controls.targetPosition.y === 0 ? "-" : Math.floor(this.blueMap.controls.targetPosition.y)); - this.elementZ.html(Math.floor(this.blueMap.controls.targetPosition.z)); - } + onBlueMapUpdateFrame = () => { + this.elementX.html(Math.floor(this.blueMap.controls.targetPosition.x)); + //this.elementY.html(this.blueMap.controls.targetPosition.y === 0 ? "-" : Math.floor(this.blueMap.controls.targetPosition.y)); + this.elementZ.html(Math.floor(this.blueMap.controls.targetPosition.z)); + } } diff --git a/BlueMapCore/src/main/webroot/js/libs/modules/Settings.js b/BlueMapCore/src/main/webroot/js/libs/modules/Settings.js index 512f81fe..0c71b6e6 100644 --- a/BlueMapCore/src/main/webroot/js/libs/modules/Settings.js +++ b/BlueMapCore/src/main/webroot/js/libs/modules/Settings.js @@ -30,93 +30,93 @@ import { getTopRightElement } from './Module.js'; import GEAR from '../../../assets/gear.svg'; export default class Settings { - constructor(blueMap) { - this.blueMap = blueMap; - const parent = getTopRightElement(blueMap); + constructor(blueMap) { + this.blueMap = blueMap; + const parent = getTopRightElement(blueMap); - $('#bluemap-settings').remove(); - this.elementMenu = $('').appendTo(parent); - this.elementSettings = $(`
    `).appendTo(parent); - this.elementSettings.click(this.onSettingsClick); + $('#bluemap-settings').remove(); + this.elementMenu = $('').appendTo(parent); + this.elementSettings = $(`
    `).appendTo(parent); + this.elementSettings.click(this.onSettingsClick); - /* Quality */ + /* Quality */ - this.elementQuality = $( - '' - ).prependTo(this.elementMenu); + this.elementQuality = $( + '' + ).prependTo(this.elementMenu); - this.elementQuality.find('li[quality]').click(this.onQualityClick); - this.elementRenderDistance = $('').prependTo(this.elementMenu); + this.elementQuality.find('li[quality]').click(this.onQualityClick); + this.elementRenderDistance = $('').prependTo(this.elementMenu); - this.init(); + this.init(); - $(document).on('bluemap-map-change', this.init); - } + $(document).on('bluemap-map-change', this.init); + } - init = () => { - this.defaultHighRes = this.blueMap.hiresTileManager.viewDistance; - this.defaultLowRes = this.blueMap.lowresTileManager.viewDistance; + init = () => { + this.defaultHighRes = this.blueMap.hiresTileManager.viewDistance; + this.defaultLowRes = this.blueMap.lowresTileManager.viewDistance; - this.elementRenderDistance.html( - 'View Distance: ' + this.blueMap.hiresTileManager.viewDistance + '' + - '' - ); + this.elementRenderDistance.html( + 'View Distance: ' + this.blueMap.hiresTileManager.viewDistance + '' + + '' + ); - this.slider = this.elementRenderDistance.find('input'); - this.slider.on('change input', this.onViewDistanceSlider); - }; + this.slider = this.elementRenderDistance.find('input'); + this.slider.on('change input', this.onViewDistanceSlider); + }; - onViewDistanceSlider = () => { - this.blueMap.hiresTileManager.viewDistance = this.pctToRenderDistance(parseFloat(this.slider.val()), this.defaultHighRes); - this.blueMap.lowresTileManager.viewDistance = this.pctToRenderDistance(parseFloat(this.slider.val()), this.defaultLowRes); - this.elementRenderDistance.find('.selection > span').html(Math.round(this.blueMap.hiresTileManager.viewDistance * 10) / 10); + onViewDistanceSlider = () => { + this.blueMap.hiresTileManager.viewDistance = this.pctToRenderDistance(parseFloat(this.slider.val()), this.defaultHighRes); + this.blueMap.lowresTileManager.viewDistance = this.pctToRenderDistance(parseFloat(this.slider.val()), this.defaultLowRes); + this.elementRenderDistance.find('.selection > span').html(Math.round(this.blueMap.hiresTileManager.viewDistance * 10) / 10); - this.blueMap.lowresTileManager.update(); - this.blueMap.hiresTileManager.update(); - }; + this.blueMap.lowresTileManager.update(); + this.blueMap.hiresTileManager.update(); + }; - onQualityClick = (event) => { - const target = event.target - const desc = $(target).html(); - this.blueMap.quality = parseFloat($(target).attr("quality")); + onQualityClick = (event) => { + const target = event.target + const desc = $(target).html(); + this.blueMap.quality = parseFloat($(target).attr("quality")); - this.elementQuality.find('li').show(); - this.elementQuality.find(`li[quality="${this.blueMap.quality}"]`).hide(); + this.elementQuality.find('li').show(); + this.elementQuality.find(`li[quality="${this.blueMap.quality}"]`).hide(); - this.elementQuality.find('.selection > span').html(desc); + this.elementQuality.find('.selection > span').html(desc); - this.blueMap.handleContainerResize(); - }; + this.blueMap.handleContainerResize(); + }; - onSettingsClick = () => { - if (this.elementMenu.css('display') === 'none'){ - this.elementSettings.addClass('active'); - } else { - this.elementSettings.removeClass('active'); - } + onSettingsClick = () => { + if (this.elementMenu.css('display') === 'none'){ + this.elementSettings.addClass('active'); + } else { + this.elementSettings.removeClass('active'); + } - this.elementMenu.animate({ - width: 'toggle' - }, 200); - } + this.elementMenu.animate({ + width: 'toggle' + }, 200); + } - pctToRenderDistance(value, defaultValue) { - let max = defaultValue * 5; - if (max > 20) max = 20; + pctToRenderDistance(value, defaultValue) { + let max = defaultValue * 5; + if (max > 20) max = 20; - return Math3.mapLinear(value, 0, 100, 1, max); - } + return Math3.mapLinear(value, 0, 100, 1, max); + } - renderDistanceToPct(value, defaultValue) { - let max = defaultValue * 5; - if (max > 20) max = 20; + renderDistanceToPct(value, defaultValue) { + let max = defaultValue * 5; + if (max > 20) max = 20; - return Math3.mapLinear(value, 1, max, 0, 100); - } + return Math3.mapLinear(value, 1, max, 0, 100); + } }