mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
More constants, fewer magic numbers.
This commit is contained in:
parent
72a0ecc195
commit
c1ae3d08f7
@ -29,6 +29,8 @@
|
||||
};
|
||||
|
||||
var ZOOM_FACTOR = 2; // the image will be twice as large as the viewer.
|
||||
var VIEWER_SIZE = 500; // We set up the viewer to be 500 px x 500 px.
|
||||
var VIEWER_PADDING = new OpenSeadragon.Point(20, 20);
|
||||
|
||||
// ----------
|
||||
/*
|
||||
@ -151,8 +153,7 @@
|
||||
var orig = new OpenSeadragon.Point(
|
||||
getRandom(100, 3000), getRandom(100, 3000)
|
||||
);
|
||||
// 500 is the viewer size; there's 20 px of padding (I think)
|
||||
var expected = orig.divide(500).plus( new OpenSeadragon.Point(20, 20) );
|
||||
var expected = orig.divide(VIEWER_SIZE).plus(VIEWER_PADDING);
|
||||
var actual = viewport.windowToViewportCoordinates(orig);
|
||||
propEqual(actual, expected, "Coordinates converted correctly for " + orig);
|
||||
|
||||
@ -193,8 +194,7 @@
|
||||
getRandom(100, 3000), getRandom(100, 3000)
|
||||
);
|
||||
|
||||
// 500 is the viewport container size; there's 20 px of padding (I think)
|
||||
var expected = orig.divide(500).plus( new OpenSeadragon.Point(20, 20) );
|
||||
var expected = orig.divide(VIEWER_SIZE).plus(VIEWER_PADDING);
|
||||
var actual = viewport.windowToViewportCoordinates(orig);
|
||||
propEqual(actual, expected, "Coordinates converted correctly for " + orig);
|
||||
|
||||
@ -214,8 +214,7 @@
|
||||
getRandom(0, 1000), getRandom(0, 1000)
|
||||
);
|
||||
|
||||
// 500 is the viewport container size; there's 20 px of padding (I think)
|
||||
var expected = orig.minus( new OpenSeadragon.Point(20, 20) ).times(500);
|
||||
var expected = orig.minus(VIEWER_PADDING).times(VIEWER_SIZE);
|
||||
var actual = viewport.viewportToWindowCoordinates(orig);
|
||||
propEqual(actual, expected, "Coordinates converted correctly for " + orig);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user