Coder Social home page Coder Social logo

core's Introduction

Rastrr editor core

Core of the rastrr editor client

Install

  1. Create file .npmrc in the root of the project with given contents:
    @rastrr-editor:registry=https://npm.pkg.github.com
    //npm.pkg.github.com/:_authToken=<PERSONAL ACCESS TOKEN WITH read:packages SCOPE>
    
  2. Run npm install @rastrr-editor/core
  3. Add to your *.d.ts file:
    /// <reference types="@rastrr-editor/core/global" />

Architecture

Main classes

Main classes

Interfaces

Interfaces

Base commands

Base commands

Development

Quick Start

  1. npm i
  2. npm run serve

NPM Scripts

  • npm run serve - run server for example on localhost:4200
  • npm run watch - run watcher for example
  • npm run dev - build example in directory 'example'
  • npm run format - format code using prettier
  • npm run format:check - check formatting errors
  • npm run lint - lint code

Debug

  1. Open browser console
  2. Execute code: localStorage.debug = '@rastrr-editor/core*'

Publish to github npm registry

  1. Login: npm login --scope=@rastrr-editor --registry=https://npm.pkg.github.com. You need to use specific access token.
  2. Execute the command: npm publish

Upgrade package version

  1. Execute the command: npm version patch|minor|major -m "Version description"

Development with realtime integration

Sometimes you need to test package integration and make some changes in realtime.

  1. Create link to the package npm link
  2. Run command npm build:watch
  3. Go to the project and add package via link npm link @rastrr-editor/core

P.s. if you are using vite, it must be run with force flag, i.e.: npx vite --force.

core's People

Contributors

coderneos avatar dimeliora avatar hunteraf87 avatar shining-mind avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

core's Issues

Eraser should use layer background color

If layer is transparent eraser should delete the pixels, otherwise it should draw like a brush with the background color.

We will need too add extra prop for the layer interface.

Incorrect undo

Reproduction steps

  1. Take brush of size 1 or 3
  2. Draw straight line and make minor movements to the side
  3. Finish the line
  4. Undo the operation

Bug
Drawn line:
image
Undo:
image

Couldn't reproduce this bug with larger odd size or any even size.

Implement eraser command

Eraser should change opacity of the underlying pixels, if eraser opacity is 100% than it replaces pixels with fully transparent pixels, otherwise it changes opacity of the underlying pixels.

For example eraser with opacity 70% should change underlying pixel rgba(255, 0, 0, 1) to rgba(255, 0, 0, 0.3).

Eraser size can be changed similarly as for the brush.

Implement history

Commands must have "undo" method.

They must store backup data for the layer.

They should be able to "redo" the action.

Refactoring

Fix current problems and improve codebase

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.