Giter Site home page Giter Site logo

aashishgarg / canvasplate Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 142 KB

JS plugin for creating different types of drawing on a simple div. Plugin is installed in the DrawingView(a construction industry application) and working as base for "annotations" functionality in the application.

CSS 5.75% HTML 1.89% JavaScript 92.36%

canvasplate's Introduction

Learning

Learning to create an independent JS plugin(CanvasPlate) for creating drawings on a HTML div element.

CanvasPlate

Provisions a plate(canvas_plate) where drawings can be drawn.

Drawing plate has its tools in the toolbar.On selecting any of the drawing tool, Canvas plate attains a state "CREATE" and gets prepared to draw a new drawing.

As plate detects a mouse down event it initializes a new drawing(as per tool selected). Here it stops the event propagation. and it places a request for drawing product in the Drawing Factory(drawing_factory). Drawing Factory provides a suitable product for the request. This product is composed of different parts - Actual drawing, Boundary path, Boundary resize circles, drawing delete element, Rotate handle, tooltip position element etc. which after getting assembled constitutes a complete product. For parts drawing factory further places a request in Parts factory((drawing_parts_factory)). Then these parts gets assembled and a complete product is prepared On moving the mouse with a mouse down it starts creating the drawing. As plate detects a mouse up event it attains a state 'IDLE'.

On pressing a drawing for long, it switches to editable mode. Drawing Drag and Resize operations are available in the editable mode only. On clicking the drawing plate all the drawings come out of the editable mode.

Now as the plate detects a mouse down on any of resize circles of any of its drawings, it attains a state 'RESIZE'. Here it again stops the event propagation. And resize procedures particular to drawing under selection starts working. Again as plate detects a mouse up event it attains a state 'IDLE'.

Now as the plate detects a mouse down event on any of the drawing element, it attains a state 'DRAG'. Here it again stops the event propagation. And drag procedures particular to drawing under selection starts working. Again as plate detects a mouse up event it attains a state 'IDLE'.

canvasplate's People

Contributors

aashishgarg avatar

Watchers

James Cloos avatar  avatar

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.