Skip to content
forked from idrawjs/idraw

A simple JavaScript framework for Drawing on the web.(一个面向Web绘图的JavaScript框架)

License

Notifications You must be signed in to change notification settings

jsstoster/idraw

This branch is 606 commits behind idrawjs/idraw:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

685be45 · Oct 8, 2021
Sep 22, 2021
Sep 6, 2021
Aug 30, 2021
Aug 16, 2021
Oct 8, 2021
Sep 20, 2021
Jul 23, 2021
Jul 23, 2021
May 23, 2021
Sep 20, 2021
May 23, 2021
May 23, 2021
Jun 10, 2021
Jun 9, 2021
Sep 20, 2021
Sep 29, 2021
Sep 20, 2021
Jul 23, 2021

Repository files navigation

iDraw.js

iDraw.js is a simple JavaScript framework for Drawing on the web.

一个面向Web绘图的JavaScript框架

idraw.js.org

CI Version License


@idraw/studio Preview

The preview of @idraw/studo. Click here to get it.

Install

npm i idraw

Getting Started

Common

import iDraw from 'idraw';

const idraw = new iDraw(
  document.querySelector('#app'),
  {
    width: 600,
    height: 400,
    contextWidth: 600,
    contextHeight: 400,
    devicePixelRatio: 1,
  }
);
idraw.addElement({
  name: "rect-1",
  x: 140,
  y: 120,
  w: 200,
  h: 100,
  type: "rect",
  desc: {
    bgColor: "#f7d3c1",
    borderRadius: 20,
    borderWidth: 4,
    borderColor: "#ff6032",
  },
});

React

import iDraw from 'idraw';
import { useEffect, useRef } from 'react';

function Demo() {
  const ref = useRef(null);
  useEffect(() => {
    const idraw = new iDraw(ref.current, {
      width: 600,
      height: 400,
      contextWidth: 600,
      contextHeight: 400,
      devicePixelRatio: 1,
    });
    idraw.addElement({
      name: "rect-001",
      x: 140,
      y: 120,
      w: 200,
      h: 100,
      type: "rect",
      desc: {
        bgColor: "#f7d3c1",
        borderRadius: 20,
        borderWidth: 4,
        borderColor: "#ff6032",
      },
    })
  }, []);

  return (
    <div ref={ref}></div>
  )
}

Vue

<template>
  <div ref="mount"></div>
</template>

<script setup >
import iDraw from 'idraw';
import { ref, onMounted } from 'vue'
const mount = ref();

onMounted(() => {
  const idraw = new iDraw(mount.value, {
    width: 600,
    height: 400,
    contextWidth: 600,
    contextHeight: 400,
    devicePixelRatio: 1,
  });
  idraw.addElement({
    name: "rect-001",
    x: 140,
    y: 120,
    w: 200,
    h: 100,
    type: "rect",
    desc: {
      bgColor: "#f7d3c1",
      borderRadius: 20,
      borderWidth: 4,
      borderColor: "#ff6032",
    },
  })
})
</script>

Contributing

We appreciate your help!

To contribute, please follow the steps:

About

A simple JavaScript framework for Drawing on the web.(一个面向Web绘图的JavaScript框架)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 70.9%
  • HTML 17.3%
  • JavaScript 10.9%
  • Other 0.9%