GithubHelp home page GithubHelp logo

purestart / vue-fabric Goto Github PK

View Code? Open in Web Editor NEW
437.0 4.0 170.0 1.61 MB

基于canvas fabric.js库 创建的vue fabric组件,定制画板,图片组合绘制

License: Apache License 2.0

JavaScript 96.69% HTML 0.07% Vue 3.24%
vue vue-fabric fabric fabricjs

vue-fabric's People

Contributors

purestart avatar zackjiang21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vue-fabric's Issues

Fantastic!!!

hello blogger! you are such an excellent coder! i read you essay and learned a lot ! i hope you can go on this great project!

如何编辑图片形变呢?

这个库挺好用的,还有个问题请教下。除了镜像和边框拉长外,图片元素如何编辑形变?

createRect with stroke?

like this?
const rect = new fabric.Rect({
top: 10,
left: 10,
width: 50,
height: 50,
hasBorder: true,
stroke: 'yellow',
strokeWidth: 3,
fill:'transparent'
});

createCircle Stroke colour

I am trying to draw a bunch of circles with createCircle, drawing the circles onto the canvas was successful however, the stroke colour isn't correct.

  watch: {
    'project.points': {
      handler: function(curr) {
        const app = this
        app.canvas.forEachObject(obj => app.canvas.remove(obj))

        // Grey Stroke
        app.$refs.canvas.createCircle({
          left: 50,
          top: 50,
          fill: 'red',
          radius: 10,
          stroke: 'blue',
          strokeWidth: 3
        })

        curr.forEach(point => {
          const { x, y } = pointConverter(false, parseInt(point.x), parseInt(point.y))

          // Grey Stroke
          app.$refs.canvas.createCircle({
            id: point.id,
            objType: point.objType,
            hasControls: false,
            fill: app.mapPointsSettings[point.type].fill,
            stroke: app.mapPointsSettings[point.type].stroke,
            strokeWidth: app.mapPointsSettings[point.type].strokeWidth,
            radius: app.mapPointsSettings[point.type].radius,
            pointType: point.type,
            originX: 'center',
            originY: 'center',
            left: x,
            top: y,
            selectabled: false,
            lockMovementX: true,
            lockMovementY: true
          })
        })
      },
      deep: true
    },
  }

All the circles show up with grey colour, I try setting the stroke to blue but that didn't work.

The data for app.mapPointsSettings[point.type]:

export const state = {
  map: {
    threshold: 2,
    dirColour: '#fab1a0',
    z: 0,
    points: {
      reportpoint: {
        fill: '#0984e3',
        stroke: '#0984e3',
        strokeWidth: 2,
        radius: 4
      },
      stoplocation: {
        fill: false,
        stroke: '#0984e3',
        strokeWidth: 2,
        radius: 6
      },
      chargestation: {
        fill: false,
        stroke: '#fdcb6e',
        strokeWidth: 2,
        radius: 9
      }
    }
  }
}

image

Note: app.canvas is this.$refs.canvas.canvas declared during created cycle.

Mirror working only on image objects

Hi.
I noticed that mirror works only if active object is of image type.
This is the code:

toggleMirror ({ flip = 'X' }) {
      let img = this.canvas.getActiveObject();
      // console.log(img);
      if (img && img.type == 'image') {  <<<<<<<<
        if (flip === 'X') {
          img.toggle('flipX');
        } else {
          img.toggle('flipY');
        }
        this.renderAll();
      }
    },

I tried to remove the check about the object type and the mirror works also for other objects.
Is there any reason for this?

Thank you.

I have a question?

why after I install.my workprogram issues note "Error in mounted hook: "TypeError: Cannot read property 'createTriangle' of undefined"".how can I do for it??

加载速度感觉有些慢啊

我直接写的Canvas绘图,相同量级的rect方形,这个要比canvas慢了1S左右,,需要做什么优化操作么

npm run dev failed

after git clone,then go to the directory,then npm install,then npm run dev,but failed

uniapp中怎么使用vue-fabric

手上有个需求需要在微信小程序中使用动态海报生成,fabricjs好像只能在h5上面跑,搜索资料发现大神你的这个项目,但是我不知道怎么在uniapp中引入,请大神指点一二

setting crossOrigin: 'anonymous'

setting crossOrigin: 'anonymous' to avoid
Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.

安装过程出现了问题

您好,我这边执行了npm install vue-fabric之后会报没有安装ajv@^6.0.0 ,ajv@^5.0.0的依赖,但是我安装了5.0之后会报6.0错误,安装了6.0之后会报5.0的错,进入一个死循环的错误,不知该如何解决,请大佬赐教

大佬node-pre-gyp WARN Using request for node-pre-gyp https download gyp ERR! find Python 怎么回事啊

node-pre-gyp WARN Using request for node-pre-gyp https download
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if the py launcher can be used to find Python 2
gyp ERR! find Python - "py.exe" is not in PATH or produced an error
gyp ERR! find Python checking if Python is C:\Python27\python.exe
gyp ERR! find Python - "C:\Python27\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Python37\python.exe
gyp ERR! find Python - "C:\Python37\python.exe" could not be run
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python npm config set python "C:\Path\To\python.exe"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.