mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
render: map composing (working with proper shifts)
This commit is contained in:
parent
4747c918e2
commit
2f3cb0e770
3 changed files with 22 additions and 8 deletions
|
@ -49,12 +49,14 @@ export class Renderer extends React.Component {
|
|||
|
||||
composeImages = ({ images, geometry, ctx }) => {
|
||||
const {
|
||||
minX, minY, shiftX, shiftY, size
|
||||
minX, minY, maxY, shiftX, shiftY, size
|
||||
} = geometry;
|
||||
|
||||
images.map(({ x, y, image }) => {
|
||||
const verticalShift = (maxY - minY) * size;
|
||||
|
||||
const posX = ((x - minX) * size) + shiftX;
|
||||
const posY = ((y - minY) * size) + (window.innerHeight - shiftY - size);
|
||||
const posY = ((y - minY) * size) - (verticalShift - shiftY);
|
||||
|
||||
return ctx.drawImage(image, posX, posY, 256, 256);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue