Skip to content

Commit

Permalink
chore: use cdn image
Browse files Browse the repository at this point in the history
  • Loading branch information
ooooorobo committed Nov 26, 2023
1 parent 28ab5d7 commit d5c2602
Show file tree
Hide file tree
Showing 129 changed files with 20 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Deploy static content to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ['main']
branches: [ 'main' ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -39,6 +39,8 @@ jobs:
run: npm install
- name: Build
run: npm run build
env:
VITE_IMAGE_URL: ${{ secrets.VITE_IMAGE_URL }}
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ dist-ssr
*.sln
*.sw?

.idea
.env
Binary file removed public/tile/0/tile000.png
Binary file not shown.
Binary file removed public/tile/0/tile001.png
Binary file not shown.
Binary file removed public/tile/0/tile002.png
Binary file not shown.
Binary file removed public/tile/0/tile003.png
Binary file not shown.
Binary file removed public/tile/0/tile004.png
Binary file not shown.
Binary file removed public/tile/0/tile005.png
Binary file not shown.
Binary file removed public/tile/0/tile006.png
Binary file not shown.
Binary file removed public/tile/0/tile007.png
Binary file not shown.
Binary file removed public/tile/0/tile008.png
Binary file not shown.
Binary file removed public/tile/0/tile009.png
Binary file not shown.
Binary file removed public/tile/0/tile010.png
Binary file not shown.
Binary file removed public/tile/0/tile011.png
Binary file not shown.
Binary file removed public/tile/0/tile012.png
Binary file not shown.
Binary file removed public/tile/0/tile013.png
Binary file not shown.
Binary file removed public/tile/0/tile014.png
Binary file not shown.
Binary file removed public/tile/0/tile015.png
Binary file not shown.
Binary file removed public/tile/0/tile016.png
Binary file not shown.
Binary file removed public/tile/0/tile017.png
Binary file not shown.
Binary file removed public/tile/0/tile018.png
Binary file not shown.
Binary file removed public/tile/0/tile019.png
Binary file not shown.
Binary file removed public/tile/0/tile020.png
Binary file not shown.
Binary file removed public/tile/0/tile021.png
Binary file not shown.
Binary file removed public/tile/0/tile022.png
Binary file not shown.
Binary file removed public/tile/0/tile023.png
Binary file not shown.
Binary file removed public/tile/0/tile024.png
Binary file not shown.
Binary file removed public/tile/0/tile025.png
Diff not rendered.
Binary file removed public/tile/0/tile026.png
Diff not rendered.
Binary file removed public/tile/0/tile027.png
Diff not rendered.
Binary file removed public/tile/0/tile028.png
Diff not rendered.
Binary file removed public/tile/0/tile029.png
Diff not rendered.
Binary file removed public/tile/0/tile030.png
Diff not rendered.
Binary file removed public/tile/0/tile031.png
Diff not rendered.
Binary file removed public/tile/0/tile032.png
Diff not rendered.
Binary file removed public/tile/0/tile033.png
Diff not rendered.
Binary file removed public/tile/0/tile034.png
Diff not rendered.
Binary file removed public/tile/0/tile035.png
Diff not rendered.
Binary file removed public/tile/0/tile036.png
Diff not rendered.
Binary file removed public/tile/0/tile037.png
Diff not rendered.
Binary file removed public/tile/0/tile038.png
Diff not rendered.
Binary file removed public/tile/0/tile039.png
Diff not rendered.
Binary file removed public/tile/0/tile040.png
Diff not rendered.
Binary file removed public/tile/0/tile041.png
Diff not rendered.
Binary file removed public/tile/0/tile042.png
Diff not rendered.
Binary file removed public/tile/0/tile043.png
Diff not rendered.
Binary file removed public/tile/0/tile044.png
Diff not rendered.
Binary file removed public/tile/0/tile045.png
Diff not rendered.
Binary file removed public/tile/0/tile046.png
Diff not rendered.
Binary file removed public/tile/0/tile047.png
Diff not rendered.
Binary file removed public/tile/0/tile048.png
Diff not rendered.
Binary file removed public/tile/0/tile049.png
Diff not rendered.
Binary file removed public/tile/0/tile050.png
Diff not rendered.
Binary file removed public/tile/0/tile051.png
Diff not rendered.
Binary file removed public/tile/0/tile052.png
Diff not rendered.
Binary file removed public/tile/0/tile053.png
Diff not rendered.
Binary file removed public/tile/0/tile054.png
Diff not rendered.
Binary file removed public/tile/0/tile055.png
Diff not rendered.
Binary file removed public/tile/0/tile056.png
Diff not rendered.
Binary file removed public/tile/0/tile057.png
Diff not rendered.
Binary file removed public/tile/0/tile058.png
Diff not rendered.
Binary file removed public/tile/0/tile059.png
Diff not rendered.
Binary file removed public/tile/0/tile060.png
Diff not rendered.
Binary file removed public/tile/0/tile061.png
Diff not rendered.
Binary file removed public/tile/0/tile062.png
Diff not rendered.
Binary file removed public/tile/0/tile063.png
Diff not rendered.
Binary file removed public/tile/0/tile064.png
Diff not rendered.
Binary file removed public/tile/0/tile065.png
Diff not rendered.
Binary file removed public/tile/0/tile066.png
Diff not rendered.
Binary file removed public/tile/0/tile067.png
Diff not rendered.
Binary file removed public/tile/0/tile068.png
Diff not rendered.
Binary file removed public/tile/0/tile069.png
Diff not rendered.
Binary file removed public/tile/0/tile070.png
Diff not rendered.
Binary file removed public/tile/0/tile071.png
Diff not rendered.
Binary file removed public/tile/0/tile072.png
Diff not rendered.
Binary file removed public/tile/0/tile073.png
Diff not rendered.
Binary file removed public/tile/0/tile074.png
Diff not rendered.
Binary file removed public/tile/0/tile075.png
Diff not rendered.
Binary file removed public/tile/0/tile076.png
Diff not rendered.
Binary file removed public/tile/0/tile077.png
Diff not rendered.
Binary file removed public/tile/0/tile078.png
Diff not rendered.
Binary file removed public/tile/0/tile079.png
Diff not rendered.
Binary file removed public/tile/0/tile080.png
Diff not rendered.
Binary file removed public/tile/0/tile081.png
Diff not rendered.
Binary file removed public/tile/0/tile082.png
Diff not rendered.
Binary file removed public/tile/0/tile083.png
Diff not rendered.
Binary file removed public/tile/0/tile084.png
Diff not rendered.
Binary file removed public/tile/0/tile085.png
Diff not rendered.
Binary file removed public/tile/0/tile086.png
Diff not rendered.
Binary file removed public/tile/0/tile087.png
Diff not rendered.
Binary file removed public/tile/0/tile088.png
Diff not rendered.
Binary file removed public/tile/0/tile089.png
Diff not rendered.
Binary file removed public/tile/1/tile000.png
Diff not rendered.
Binary file removed public/tile/1/tile001.png
Diff not rendered.
Binary file removed public/tile/1/tile002.png
Diff not rendered.
Binary file removed public/tile/1/tile003.png
Diff not rendered.
Binary file removed public/tile/1/tile004.png
Diff not rendered.
Binary file removed public/tile/1/tile005.png
Diff not rendered.
Binary file removed public/tile/1/tile006.png
Diff not rendered.
Binary file removed public/tile/1/tile007.png
Diff not rendered.
Binary file removed public/tile/1/tile008.png
Diff not rendered.
Binary file removed public/tile/1/tile009.png
Diff not rendered.
Binary file removed public/tile/1/tile010.png
Diff not rendered.
Binary file removed public/tile/1/tile011.png
Diff not rendered.
Binary file removed public/tile/1/tile012.png
Diff not rendered.
Binary file removed public/tile/1/tile013.png
Diff not rendered.
Binary file removed public/tile/1/tile014.png
Diff not rendered.
Binary file removed public/tile/1/tile015.png
Diff not rendered.
Binary file removed public/tile/1/tile016.png
Diff not rendered.
Binary file removed public/tile/1/tile017.png
Diff not rendered.
Binary file removed public/tile/1/tile018.png
Diff not rendered.
Binary file removed public/tile/1/tile019.png
Diff not rendered.
Binary file removed public/tile/1/tile020.png
Diff not rendered.
Binary file removed public/tile/1/tile021.png
Diff not rendered.
Binary file removed public/tile/1/tile022.png
Diff not rendered.
Binary file removed public/tile/1/tile023.png
Diff not rendered.
Binary file removed public/tile/1/tile024.png
Diff not rendered.
Binary file removed public/tile/2/tile000.png
Diff not rendered.
Binary file removed public/tile/2/tile001.png
Diff not rendered.
Binary file removed public/tile/2/tile002.png
Diff not rendered.
Binary file removed public/tile/2/tile003.png
Diff not rendered.
Binary file removed public/tile/2/tile004.png
Diff not rendered.
Binary file removed public/tile/2/tile005.png
Diff not rendered.
Binary file removed public/tile/2/tile006.png
Diff not rendered.
Binary file removed public/tile/2/tile007.png
Diff not rendered.
Binary file removed public/tile/2/tile008.png
Diff not rendered.
8 changes: 5 additions & 3 deletions src/business/map/tile.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { ORIGINAL_MAP_HEIGHT, ORIGINAL_MAP_WIDTH, ORIGINAL_TILE_SIZE } from './constants.ts';

const columnCount: Record<string, number> = {
'0': 10,
'1': 5,
'2': 3,
};

export const isValidPoint = (x: number, y: number, columnCount: number) => {
return x < columnCount && (x + columnCount * y) <= 100;
export const isValidPoint = (x: number, y: number, scale: number) => {
return x * ORIGINAL_TILE_SIZE <= ORIGINAL_MAP_WIDTH * scale && y * ORIGINAL_TILE_SIZE <= ORIGINAL_MAP_HEIGHT * scale;
};

export const getColumnCount = (level: number) => {
return columnCount[level.toString()] ?? 0;
};

export const getFileName = (x: number, y: number, level: number) => {
return `/map/tile/${level}/tile${(x + getColumnCount(level) * y).toString().padStart(3, '0')}.png`;
return import.meta.env.VITE_IMAGE_URL + `/tile/${level}/tile${(x + getColumnCount(level) * y).toString().padStart(3, '0')}.png`;
};
6 changes: 3 additions & 3 deletions src/components/layer/MapTileLayer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { component$ } from '@builder.io/qwik';
import { ORIGINAL_TILE_SIZE } from '../../business/map/constants.ts';
import { getTileRange } from '../../business/map/calculator.ts';
import { getTileRange, getZoomScale } from '../../business/map/calculator.ts';
import { generatePointListInRange } from '../../util/point.ts';
import { makeRect } from '../../util/rect.ts';
import { Point } from '../../type/Point.ts';
import { getColumnCount, getFileName, isValidPoint } from '../../business/map/tile.ts';
import { getFileName, isValidPoint } from '../../business/map/tile.ts';

type Props = {
level: number;
Expand All @@ -20,7 +20,7 @@ export const MapTileLayer = component$(({ level, screenLeftTop, mapLeftTop }: Pr

return <div class={'tile_layer'}>
{tilePoints.map(({ x, y }) =>
isValidPoint(x, y, getColumnCount(level)) && <MapTile x={x} y={y} level={level} mapLeftTop={mapLeftTop} />,
isValidPoint(x, y, getZoomScale(level)) && <MapTile x={x} y={y} level={level} mapLeftTop={mapLeftTop} />,
)}
</div>;
});
Expand Down
8 changes: 8 additions & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly VITE_IMAGE_URL: string;
}

interface ImportMeta {
readonly env: ImportMetaEnv;
}

0 comments on commit d5c2602

Please sign in to comment.