File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,6 @@ export class ImageFormatPlugin {
255255
256256 }
257257
258-
259258 // return bounding box
260259 return {
261260 box : [
@@ -280,13 +279,16 @@ export class ImageFormatPlugin {
280279
281280 }
282281
283- // the scale ration of the image at this level
284- const { pixelWidth, pixelHeight } = tiling . getLevel ( tiling . maxLevel ) ;
285- const { pixelWidth : levelWidth , pixelHeight : levelHeight } = tiling . getLevel ( level ) ;
286- let geometricError = Math . max ( 1 / levelWidth , 1 / levelHeight ) ;
282+ // Calculate geometric error: size of one pixel in world space.
283+ // The tile contents span [0, 1] along Y and [0, aspectRatio] along X.
284+ const { pixelWidth, pixelHeight } = tiling . getLevel ( level ) ;
285+ let geometricError = Math . max ( tiling . aspectRatio / pixelWidth , 1 / pixelHeight ) ;
286+
287+ // apply deprecated pixelSize scaling if specified
287288 if ( pixelSize ) {
288289
289- geometricError *= pixelSize * Math . max ( pixelWidth , pixelHeight ) ;
290+ const maxLevelInfo = tiling . getLevel ( tiling . maxLevel ) ;
291+ geometricError *= pixelSize * Math . max ( maxLevelInfo . pixelWidth , maxLevelInfo . pixelHeight ) ;
290292
291293 }
292294
You can’t perform that action at this time.
0 commit comments