This commit is contained in:
Eric van der Vlist 2022-10-14 21:17:13 +02:00
parent 2122d2e79b
commit 39aa3eb49d
3 changed files with 8 additions and 14 deletions

View File

@ -1,10 +1,5 @@
import { IonContent, ReactComponentOrElement } from '@ionic/react'; import { IonContent } from '@ionic/react';
import react, { import react, { useEffect, useState } from 'react';
ReactComponentElement,
useEffect,
useRef,
useState,
} from 'react';
import './Map.css'; import './Map.css';
import MouseHandler from './MouseHandler'; import MouseHandler from './MouseHandler';
@ -94,7 +89,6 @@ const Map: react.FC<MapProperties> = (props: MapProperties) => {
/> />
); );
} else { } else {
// tileRow.push(<g key={key} />);
tileRow.push(tiledLayer[row][col]); tileRow.push(tiledLayer[row][col]);
} }
} }
@ -102,7 +96,7 @@ const Map: react.FC<MapProperties> = (props: MapProperties) => {
} }
setTiledLayer(newTiledLayer); setTiledLayer(newTiledLayer);
}, [shift, zoom, nbTiles]); }, [shift, zoom, nbTiles, props.height, props.width]);
// console.log(`tiledLayer: ${JSON.stringify(tiledLayer)}`); // console.log(`tiledLayer: ${JSON.stringify(tiledLayer)}`);

View File

@ -1,4 +1,4 @@
import react, { Fragment, ReactElement, ReactSVGElement } from 'react'; import react, { ReactElement } from 'react';
interface SlippyBoardProperties { interface SlippyBoardProperties {
boardSize: number; boardSize: number;

View File

@ -1,4 +1,4 @@
import react, { useEffect, useMemo, useRef, useState } from 'react'; import react, { useEffect, useRef } from 'react';
interface TileProperties { interface TileProperties {
href?: string; href?: string;
@ -8,7 +8,7 @@ interface TileProperties {
} }
const Tile: react.FC<TileProperties> = (props: TileProperties) => { const Tile: react.FC<TileProperties> = (props: TileProperties) => {
// console.log(`Rendering <Tile/>`); // console.log(`Rendering <Tile/>`);
const g = useRef<SVGGElement>(null); const g = useRef<SVGGElement>(null);
const timeout = (ms: number) => { const timeout = (ms: number) => {
@ -37,7 +37,7 @@ const Tile: react.FC<TileProperties> = (props: TileProperties) => {
) as unknown as SVGImageElement; ) as unknown as SVGImageElement;
svgImage.setAttribute('width', '256'); svgImage.setAttribute('width', '256');
svgImage.setAttribute('height', '256'); svgImage.setAttribute('height', '256');
// @ts-ignore // @ts-ignore
svgImage.setAttribute('href', props.href); svgImage.setAttribute('href', props.href);
// svgImage.setAttribute('x', '0'); // svgImage.setAttribute('x', '0');
// svgImage.setAttribute('y', '0'); // svgImage.setAttribute('y', '0');
@ -45,7 +45,7 @@ const Tile: react.FC<TileProperties> = (props: TileProperties) => {
}; };
loadImage(); loadImage();
} }
}, [props.href]); }, [props.href, props.delay]);
// const children = useMemo( // const children = useMemo(
// () => ( // () => (