`viewer.navigation.fitBounds` 没有边距

`viewer.navigation.fitBounds` without margin

我想创建特定图像部分的高分辨率屏幕截图。我的方法是从我的部分的每个季度(左上、右上、左下、右下)创建多个屏幕截图。为此,我使用 viewer.navigation.fitBounds。但是,似乎有一点我想去掉的边距,因为我不能轻易地将四分之一的屏幕截图拼接在一起。

viewer.navigation.fitBounds 是否应该完全符合边界,因此,这是我这边的使用错误吗?

示例

黑色标记代表我在调用 Autodesk.Viewing.ScreenShot.getScreenShotWithBounds 时使用的右上角屏幕截图的边界框。但是,黑色标记与顶部和底部边框之间还留有一些 space。

函数 Navigation.fitBounds 使用 Navigation.computeFit,它使用以下边距设置,默认情况下每边增加 5%:

  // 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;

您可以在调用 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;