mirror of
https://github.com/ankitects/anki.git
synced 2025-11-08 13:47:13 -05:00
* fix: blur in io, remove panzoom and use fabricjs for panzoom - remove panzoom - implement panzoom using fabricjs - set background image for canvas - add bounding rect for canvas - draw or add point inside in bounding rect - update zoom tool * support pinch to zoom on mobile client * fix lagging of canvas, zoom in draw mode * panning in touch events
24 lines
605 B
TypeScript
24 lines
605 B
TypeScript
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
import type { fabric } from "fabric";
|
|
|
|
import { stopDraw } from "./lib";
|
|
import { onPinchZoom } from "./tool-zoom";
|
|
|
|
export const drawCursor = (canvas: fabric.Canvas): void => {
|
|
canvas.selectionColor = "rgba(100, 100, 255, 0.3)";
|
|
stopDraw(canvas);
|
|
|
|
canvas.on("mouse:down", function(o) {
|
|
if (o.target) {
|
|
return;
|
|
}
|
|
});
|
|
|
|
canvas.on("mouse:move", function(o) {
|
|
if (onPinchZoom(o)) {
|
|
return;
|
|
}
|
|
});
|
|
};
|