Added drag and drop support to map upload

This commit is contained in:
Mitchell McCaffrey
2020-04-15 21:15:16 +10:00
parent 64f284ebb7
commit 279d83122f
2 changed files with 69 additions and 9 deletions

View File

@@ -18,8 +18,7 @@ function AddMapButton({ onMapChanged }) {
const mapDataRef = useRef(null);
const [mapSource, setMapSource] = useState(null);
function handleImageUpload(event) {
const file = event.target.files[0];
function handleImageUpload(file) {
const url = URL.createObjectURL(file);
let image = new Image();
image.onload = function () {