Add global multipliers for conversions.

twipsToPixels and pixelsToTwips are added.

Signed-off-by: Gökay ŞATIR <gokaysatir@gmail.com>
Change-Id: I794a7c4ee826510f3bf1b97b4a456bf05ec2f3ae
This commit is contained in:
Gökay ŞATIR 2021-07-24 16:23:05 +03:00
parent 01505278a6
commit 05d0ccf5a5
2 changed files with 8 additions and 0 deletions

View file

@ -5,6 +5,8 @@ window.app = { // Shouldn't have any functions defined.
definitions: {}, // Class instances are created using definitions under this variable.
dpiScale: window.devicePixelRatio,
roundedDpiScale: Math.round(window.devicePixelRatio),
twipsToPixels: 0, // Twips to pixels multiplier.
pixelsToTwips: 0, // Pixels to twips multiplier.
file: {
editComment: false,
readOnly: true,

View file

@ -1179,6 +1179,9 @@ L.CanvasTileLayer = L.Layer.extend({
app.tile.size.twips = [this._tileWidthTwips, this._tileHeightTwips];
app.file.size.pixels = [Math.round(app.tile.size.pixels[0] * (app.file.size.twips[0] / app.tile.size.twips[0])), Math.round(app.tile.size.pixels[1] * (app.file.size.twips[1] / app.tile.size.twips[1]))];
app.view.size.pixels = app.file.size.pixels.slice();
app.twipsToPixels = app.tile.size.pixels[0] / app.tile.size.twips[0];
app.pixelsToTwips = app.tile.size.twips[0] / app.tile.size.pixels[0];
},
_checkSpreadSheetBounds: function (newZoom) {
@ -1236,6 +1239,9 @@ L.CanvasTileLayer = L.Layer.extend({
app.tile.size.twips[1] = this.options.tileHeightTwips;
}
app.twipsToPixels = app.tile.size.pixels[0] / app.tile.size.twips[0];
app.pixelsToTwips = app.tile.size.twips[0] / app.tile.size.pixels[0];
var bounds = this._map.getPixelWorldBounds(this._tileZoom);
if (bounds) {
this._globalTileRange = this._pxBoundsToTileRange(bounds);