Skip to content

Instantly share code, notes, and snippets.

View pixobe's full-sized avatar

Pixobe pixobe

View GitHub Profile
@balazsbotond
balazsbotond / ABOUT.md
Last active April 25, 2024 11:19
Simple Canvas Pan And Zoom

Simple Canvas Pan And Zoom

I needed a simple way to implement dragging and scroll wheel zooming on an HTML canvas, but I couldn't find a pure JS example. The most popular one uses an SVG node to convert coordinates, but I didn't like that so I created my own version.

Try it here: https://jsfiddle.net/balazsbotond/6n2uzjkq/30/

/*------------------------
Libraries
------------------------*/
const axios = require("axios");
const fs = require("fs");
const FormData = require("form-data");
/*------------------------
Download the file.
Good article on how to download a file and send with form data - https://maximorlov.com/send-a-file-with-axios-in-nodejs/