Reputation: 281
I want to create high resolution screenshots of a specific image section. My approach is to create multiple screenshots from each quarter of my section (top left, top right, bottom left, bottom right). For that I am using viewer.navigation.fitBounds
. However, there seems to be a little margin which I wanna get rid of because I cannot stitch the quarter screenshots together easily.
Is viewer.navigation.fitBounds
supposed to fit the bounds perfectly and therefore, is it a usage error on my side?
The black markers represent my bounding box for upper right screenshot which I use when calling Autodesk.Viewing.ScreenShot.getScreenShotWithBounds
. However, there is some space left between the black markers and the top and bottom border.
Upvotes: 0
Views: 329
Reputation: 281
The function Navigation.fitBounds
uses Navigation.computeFit
which uses the following margin settings adding 5% by default to each side:
// Change these constants to alter the margin ratios (think, percentages/100).
// The margins are how much to add above and below. For example, setting the
// margin to 25% (0.25) would give a margin of 25% above, 50% in the middle for
// content, and 25% below. This value should never be >= 0.50, as that would
// leave no area for the content to display.
// The offsets are how much to shift the view. For example, shifting 50% (0.50)
// vertically would move the displayed area such that only the bottom half of
// the drawing area would be seen.
this.FIT_TO_VIEW_VERTICAL_MARGIN = 0.05;
this.FIT_TO_VIEW_VERTICAL_OFFSET = 0.00;
this.FIT_TO_VIEW_HORIZONTAL_MARGIN = 0.05;
this.FIT_TO_VIEW_HORIZONTAL_OFFSET = 0.00;
You can set these variables anywhere before calling viewer.navigation.fitBounds
:
const viewer = NOP_VIEWER; // your viewer instance
viewer.navigation.FIT_TO_VIEW_VERTICAL_MARGIN = 0.0;
viewer.navigation.FIT_TO_VIEW_HORIZONTAL_MARGIN = 0.0;
Upvotes: 1