Browse Source

Remove references to devicePixelRatio

tags/v0.8.0
Vildravn 3 years ago
parent
commit
a385769b87
5 changed files with 11 additions and 16 deletions
  1. +2
    -3
      src/client/js/input.js
  2. +2
    -2
      src/client/js/misc/helpers.js
  3. +4
    -7
      src/client/js/rendering/renderer.js
  4. +2
    -3
      src/client/ui/templates/passives/input.js
  5. +1
    -1
      src/client/ui/templates/passives/passives.js

+ 2
- 3
src/client/js/input.js View File

@@ -226,9 +226,8 @@ define([
if ((!el.hasClass('ui-container')) || (el.hasClass('blocking')))
return;

const zoom = window.devicePixelRatio;
this.mouse.x = (e.offsetX * zoom) + renderer.pos.x;
this.mouse.y = (e.offsetY * zoom) + renderer.pos.y;
this.mouse.x = e.offsetX + renderer.pos.x;
this.mouse.y = e.offsetY + renderer.pos.y;
}
},



+ 2
- 2
src/client/js/misc/helpers.js View File

@@ -1,6 +1,6 @@
window.isMobile = /Mobi|Android/i.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
window.scale = isMobile ? 32 : 40 * window.devicePixelRatio;
window.scaleMult = isMobile ? 4 : 5 * window.devicePixelRatio;
window.scale = isMobile ? 32 : 40;
window.scaleMult = isMobile ? 4 : 5;

//eslint-disable-next-line no-extend-native
Array.prototype.spliceWhere = function (callback, thisArg) {


+ 4
- 7
src/client/js/rendering/renderer.js View File

@@ -81,9 +81,8 @@ define([
events.on('onToggleFullscreen', this.toggleScreen.bind(this));
events.on('onMoveSpeedChange', this.adaptCameraMoveSpeed.bind(this));

let zoom = isMobile ? 1 : window.devicePixelRatio;
this.width = $('body').width() * zoom;
this.height = $('body').height() * zoom;
this.width = $('body').width();
this.height = $('body').height();

this.showTilesW = Math.ceil((this.width / scale) / 2) + 3;
this.showTilesH = Math.ceil((this.height / scale) / 2) + 3;
@@ -179,11 +178,9 @@ define([
onResize: function () {
if (isMobile)
return;
let zoom = window.devicePixelRatio;

this.width = $('body').width() * zoom;
this.height = $('body').height() * zoom;
this.width = $('body').width();
this.height = $('body').height();

this.showTilesW = Math.ceil((this.width / scale) / 2) + 3;
this.showTilesH = Math.ceil((this.height / scale) / 2) + 3;


+ 2
- 3
src/client/ui/templates/passives/input.js View File

@@ -187,9 +187,8 @@ define([
if ((!el.hasClass('canvas')) || (el.hasClass('blocking')))
return;

const zoom = window.devicePixelRatio;
this.mouse.x = e.offsetX * zoom;
this.mouse.y = e.offsetY * zoom;
this.mouse.x = e.offsetX;
this.mouse.y = e.offsetY;

this.mouse.raw = e;



+ 1
- 1
src/client/ui/templates/passives/passives.js View File

@@ -1,4 +1,4 @@
let zoom = window.devicePixelRatio;
let zoom = 1;
if (isMobile)
zoom /= 2;



Loading…
Cancel
Save