UNPKG

@avolutions/canvas-painter

Version:

CanvasPainter.js is a simple yet powerful JavaScript library for drawing basic shapes (rectangles, circles, etc.) on HTML5 Canvas with ease. Perfect for creating 2D graphics in your web projects.

34 lines (33 loc) 800 B
import { MouseButton } from "../types/MouseButton.js"; /** * Options for configuring the pan behavior of a canvas. */ export class PanOptions { /** * List of mouse buttons that are used for panning. */ mouseButtons; /** * Whether panning with the mouse is enabled. */ useMouse; /** * Default pan options. */ static DefaultOptions = { useMouse: true, mouseButtons: [MouseButton.Left] }; /** * Creates a new instance of PanOptions. * * @param options - The partial options provided by the user. */ constructor(options = {}) { const optionsWithDefaults = { ...PanOptions.DefaultOptions, ...options }; Object.assign(this, optionsWithDefaults); } }