Skip to content

Commit

Permalink
fix rotate image (center/top-left)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpvoigt committed Sep 26, 2023
1 parent 5f3646f commit aa53ab1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/store/data/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// import { dom2base64, str2base64 } from '@/tools/github'
import { uuid } from '@/tools/uuid.js'
// import OpenSeadragon from 'openseadragon'
import OpenSeadragon from 'openseadragon'
// import { rotatePoint, getOuterBoundingRect } from '@/tools/trigonometry.js'
import { getOsdRects } from '@/tools/facsimileHelpers.js'
import { /* convertRectUnits, */ sortRastrumsByVerticalPosition } from '@/tools/mei.js'
import { rotatePoint } from '@/tools/trigonometry'
// import { getRectFromFragment } from '@/tools/trigonometry.js'
// import { Base64 } from 'js-base64'

Expand Down Expand Up @@ -1920,10 +1921,14 @@ const dataModule = {
return null
}

// TiledImage is rotated by center so we have to correct the position ...
const rotorigin = rotatePoint(new OpenSeadragon.Point(0, 0), new OpenSeadragon.Point(rects.image.w / 2, rects.image.h / 2), rects.rotation)
// console.log('image correction', rotorigin)

const tileSource = {
tileSource: page.uri,
x: rects.image.x,
y: rects.image.y,
x: rects.image.x + rotorigin.x,
y: rects.image.y + rotorigin.y,
width: rects.image.w,
degrees: rects.rotation * -1
}
Expand Down

0 comments on commit aa53ab1

Please sign in to comment.