GithubHelp home page GithubHelp logo

Comments (10)

katjaq avatar katjaq commented on August 23, 2024 1

@geoffdavis92 : Thank you very much for your contribution! πŸ˜ƒ
We updated the first entry in this issue to include the list of tools that exist and would ideally be extracted into their own files.
Also, it sounds great to aim at migrating these global functions towards Webpack. Once the tools are extracted, that should be easier and could be our aim? :) I agree with @xgui3783 !!! πŸ˜ƒ

from microdraw.

katjaq avatar katjaq commented on August 23, 2024

i am separating the bezierToPolygon function!

from microdraw.

r03ert0 avatar r03ert0 commented on August 23, 2024

in pull request #76 you can see how to encapsulate tools like draw and draw polygon that require a mouseDown and a mouseUp handler. This should help encapsulating some other tools. It doesn't work for tools that require the mouseDrag handler, such as rotate.

The encapsulation is not complete, and there are still references to the "draw" and "drawPolygon" tool in microdraw.js. These should be completely removed when the encapsulation will be finished.

from microdraw.

katjaq avatar katjaq commented on August 23, 2024

for all tools that simply require a click, this is the way to go:

  1. find the function you would like to separate inside public/js/microdraw.js

  2. extract the function's code from microdraw.js and add your separated tool to the /public/js/tools/yourTool.js

  3. add your tool to the Microdraw object's extension (search inside public/js/microdraw.js for

// extend Microdraw with tools

and add the two according lines there

  1. and change it in the switch case for your tool by finding your tool inside public/js/microdraw.js
switch(me.selectedTool) {

and you are done πŸ˜ƒ
\ΓΆ/ thank youuuu

from microdraw.

geoffdavis92 avatar geoffdavis92 commented on August 23, 2024

@katjaq are there any more tools that need extraction? I can't readily identify any remaining tools.

Also, is there any desire to migrate to using ES Modules and Webpack? It seems like this issue and #59 would greatly benefit from having explicitly-listed module imports/exports in each file, and would likely make debugging/adding features easier. (Take with a grain of salt, I'm just looking through the codebase, so there's likely nuances I'm missing)

from microdraw.

xgui3783 avatar xgui3783 commented on August 23, 2024

ES module would be a godsent.

Was going to make a snarky remark about the complexity of webpack, but after some mental gymnastics, I came to the conclusion that it definitely could work.

If there are enough interest we could implement.

from microdraw.

geoffdavis92 avatar geoffdavis92 commented on August 23, 2024

@xgui3783 cool. I'm not sure what the unique challenges are since I haven't looked at this codebase very in-depth, but wanted to offer this as an option, since that's essentially what this is asking for.

I'd be willing to help migrate these global functions towards Webpack and setup the config; I'm in no way a master but have been using it frequently on a number of side projects.

from microdraw.

xgui3783 avatar xgui3783 commented on August 23, 2024

from microdraw.

r03ert0 avatar r03ert0 commented on August 23, 2024

i'll work on splitRegion! done :D

from microdraw.

katjaq avatar katjaq commented on August 23, 2024

cool! :)
I'll work on select! done :D

from microdraw.

Related Issues (20)

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.