diff --git a/src/redux/editor/sagas.ts b/src/redux/editor/sagas.ts index 2fc13f6..39275bc 100644 --- a/src/redux/editor/sagas.ts +++ b/src/redux/editor/sagas.ts @@ -118,7 +118,6 @@ function* getRenderData() { yield put(editorSetRenderer({ info: 'Загрузка тайлов', progress: 0.1 })); const { route, stickers, provider }: ReturnType = yield select(selectMap); - const gpx: ReturnType = yield select(selectEditorGpx); const { distance }: ReturnType = yield select(selectEditor); const canvas = document.getElementById('renderer'); diff --git a/src/utils/renderer.ts b/src/utils/renderer.ts index 22cfdc2..b9d02bc 100644 --- a/src/utils/renderer.ts +++ b/src/utils/renderer.ts @@ -66,13 +66,12 @@ const tileToLatLng = (point: { x: number; y: number }): LatLng => { }; export const getTilePlacement = (): ITilePlacement => { - const map = MainMap; const width = window.innerWidth; const height = window.innerHeight; // map corners - const southWest = map.getBounds().getSouthWest(); - const northEast = map.getBounds().getNorthEast(); + const southWest = MainMap.getBounds().getSouthWest(); + const northEast = MainMap.getBounds().getNorthEast(); // map corner's tile files [x, y, z] to fetch from server const southWestTile = latLngToTile(southWest); @@ -85,8 +84,8 @@ export const getTilePlacement = (): ITilePlacement => { // actual coords of file's corners (they're shifted from view) const southWestTileCoords = tileToLatLng(southWestTile); - const tileTransformTranslate = map.latLngToLayerPoint(southWestTileCoords); - const msw2 = map.latLngToLayerPoint(southWest); + const tileTransformTranslate = MainMap.latLngToLayerPoint(southWestTileCoords); + const msw2 = MainMap.latLngToLayerPoint(southWest); return { minX, @@ -317,7 +316,7 @@ const measureRect = (x: number, y: number, width: number, height: number, scale: rectY: y - 7 * scale - height / 2, rectW: width + 46 * scale, rectH: height + 20 * scale, - textX: reversed ? x - width - 36 : x + 36 * scale, + textX: reversed ? x - width - (36 * scale) : x + 36 * scale, }); const measureDistRect = ( @@ -402,7 +401,6 @@ const composeStickerText = ( // text ctx.fillStyle = 'white'; lines.map((line, i) => ctx.fillText(line, textX, rectY + (6 + 16 * (i + 1)) * scale)); - // ctx.scale(1/scale, 1/scale); }; export const composeDistMark = ({