Search code examples
javascriptfabricjsgesture

Fabricjs build 1.7.15 with gesture support


I've been working on a project with fabricjs. Great library, but I ran into a stupid problem which I can't seem to solve. I've been working with version 1.7.15 and prefer to stick to the stable version for now instead of upgrading to version 2.0.beta. I've used a fabricjs version without gestures support so far, but now I would like to include the gesture support. Where can I build a version of fabricjs ^1.7 with gesture support now? Since the custom build on the site of fabricjs only seem to work with 2.0.beta.

Hope you can help out! Thanks in advance :)


Solution

  • Actually the only way to build it is using the github repository.

    get yourself a copy of nodejs and npm, and git.

    step 1 clone the repository:

    git clone https://github.com/kangax/fabric.js.git

    you will get a new folder called fabric.js. step 2 enter the folder and install fabric, this should give you uglifyjs that is needed to complete the build.

    cd fabric.js npm install ./

    step 3 switch to version 1.x

    git checkout 1.x

    step 4 run the build command as advised in the repository

    nodejs build.js modules=ALL exclude=node

    If you do not want to do all this, since fabric is built in plain es5, you can still include fabricjs in your page and include the gesture module immediately after.

    The gesture module is this file here:

    https://github.com/kangax/fabric.js/blob/1.x/src/mixins/canvas_gestures.mixin.js