0

我目前正在开发一个使用 OpenSeadragon 的查看器,以及用于添加裁剪工具的 Picturae 选择插件。

选择工作正常,但是当我旋转图像时,选择的旋转行为很奇怪:它围绕左下角旋转,而不是围绕选择中心旋转。

我制作了一个案例视频:当图像是直的时选择旋转的正常行为,以及旋转图像时的奇怪行为。

想要的效果是围绕选择中心旋转......

我使用以下代码来初始化选择:

var selection = viewer.selection({
  element:                 null, // html element to use for overlay
  showSelectionControl:    true, // show button to toggle selection mode
  toggleButton:            null, // dom element to use as toggle button
  showConfirmDenyButtons:  true,
  styleConfirmDenyButtons: true,
  returnPixelCoordinates:  true,
  keyboardShortcut:        'c', // key to toggle selection mode
  rect:                    null, // initial selection as an OpenSeadragon.SelectionRect object
  startRotated:            false, // alternative method for drawing the selection; useful for rotated crops
  startRotatedHeight:      0.1, // only used if startRotated=true; value is relative to image height
  restrictToImage:         true, // true = do not allow any part of the selection to be outside the image
  onSelection:             function(rect) { viewer_crop_download(rect); },
  cancel : function(){ viewer_crop_disable(); },
  prefixUrl:     PREFIX_URL,
  navImages:
  {
    selection: {
     REST:   'selection_rest.png',
     GROUP:  'selection_grouphover.png',
     HOVER:  'selection_hover.png',
     DOWN:   'selection_pressed.png'
    },
    selectionConfirm: {
     REST:   'selection_confirm_rest.png',
     GROUP:  'selection_confirm_grouphover.png',
     HOVER:  'selection_confirm_hover.png',
     DOWN:   'selection_confirm_pressed.png'
    },
    selectionCancel: {
     REST:   'selection_cancel_rest.png',
     GROUP:  'selection_cancel_grouphover.png',
     HOVER:  'selection_cancel_hover.png',
     DOWN:   'selection_cancel_pressed.png'
    },
  }
});

开放海龙: https ://openseadragon.github.io

图片选择插件: https ://picturae.github.io/openseadragonselection/

谢谢 !

4

0 回答 0