arch-inc / fabricjs-psbrush

Fabric.js用の感圧ブラシ実装 / A lightweight pressure-sensitive brush implementation for Fabric.js
https://arch-inc.github.io/fabricjs-psbrush/
Other
62 stars 24 forks source link

Error using fabricjs-psbrush in vuejs #37

Closed qbunia closed 2 years ago

qbunia commented 2 years ago

Hi,

I`m using vuejs 2 with vue-cli, webpack and typescript. I imported fabric and fabricjs-psbrush as you mentioned in docs. My code:

import { PSBrush } from "@arch-inc/fabricjs-psbrush";
import { fabric } from "fabric";

this.canvas = new fabric.Canvas(document.getElementById("signatureCanvas"), 
{
    isDrawingMode: true,
    enablePointerEvents: true,
    //width: 600 - 2*15 - 2*1,
    height: 200,
    backgroundColor: "#fff"
});

let brush = new fabric.PSBrush(this.canvas);
brush.width = 30;
brush.color = "#000";
this.canvas.freeDrawingBrush = brush;

I`m getting error: Uncaught TypeError: fabric__WEBPACK_IMPORTED_MODULE_2__.fabric.PSBrush is not a constructor

arcatdmz commented 2 years ago

Hi @qbunia, would you simply use new PSBrush constructor instead of new fabric.PSBrush and check if it works?

qbunia commented 2 years ago

@arcatdmz Thanks it worked, we can close the issuse.