Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Type : Enable single line block char drawing (├, ─, │, └) #2

Closed
ogt opened this issue Apr 8, 2013 · 10 comments
Closed

Comments

@ogt
Copy link
Owner

ogt commented Apr 8, 2013

Sourced @oDesk for $100 - Job Completed Successfully

Add a type that uses , , , etc chars instead of the regular bar |, dash - and plus + .
Note that in this case we have 11 chars (4 corner chars, 4 T chars and the + |, - .)

List of chars
http://en.wikipedia.org/wiki/Box-drawing_character

┼ ─│
┌ ┐└ ┘
├ ┤┬ ┴

All the code should be included in a new file blocklines.js that implements the update function.

You will extend the drawingengine.js code below...

      if (!model.type || model.type == 'simple') {
        updateFunction = require('./simplelines.js');
      }
      //else if .... other types of chars 
      if (updateFunction) {
        updateFunction(model,s,oldpos,newpos, brush);
      }

to use the new block characters :

      if (!model.type || model.type == 'simple') {
        updateFunction = require('./simplelines.js');
      }
      else if (model.type == 'block') {
        updateFunction = require('./blocklines.js');
      }
      if (updateFunction) {
        updateFunction(model,s,oldpos,newpos, brush);
      }

To simplify things I have put in this issue only single line drawing (introduction of the double line characters in the blocklines.js is part of a separate issue #3 ).
You will also need to add a test file (similar to what exists now test/test1.js for the simple type). You should at least reproduce the existing 8 tests (with the new characters). You may need to add more to maintain the current 100% code coverage by the tests.

When testing the project from the web interface, entering block in the type fieldand then pressing the restart button should switch to the new type. At that point I should be able to "draw" using the arrow keys. Attempting to create a double should have no effect - a single line would appear instead.

Follow the instructions in the README.md for making changes.


Budget : $100
Primary Skill : Nodejs
Required Skills : Nodejs, Javascript
@GulinSS
Copy link
Contributor

GulinSS commented May 1, 2013

It will be refactored to using 3x3 matrix for transformations. May be it will solve issue 3 in one shot.

@GulinSS
Copy link
Contributor

GulinSS commented May 1, 2013

It will have some DSL for support extensions drawings in future (double line, thick line).

@GulinSS
Copy link
Contributor

GulinSS commented May 1, 2013

If it will not be have things above it will have overkill cyclomatic complexity and hard to support.

@ogt
Copy link
Owner Author

ogt commented May 1, 2013

I am not sure what you have in mind, but please go ahead and try (and refactor the simple type as well)
Feel free to take on Issues #3 ($40) and Issue #4 ($120) as well in one shot.
Can you give me an estimate on how long it will take you ?

@GulinSS
Copy link
Contributor

GulinSS commented May 1, 2013

I try it already. There is an intermediate result. See https://github.com/GulinSS/boxchareditor/commits

@GulinSS
Copy link
Contributor

GulinSS commented May 1, 2013

But no tests yet.

@ogt
Copy link
Owner Author

ogt commented May 1, 2013

Ok, I checkout your code. I see what you are doing - but it is still far from complete. Very few of the transformation work as expected. Here is some feedback:

  • Your editor rewrote the complete html (using 4-space tabs) (thats fine with me) but make sure that this stays consistent at either 4 or 2.
  • The page is a bit diff (bigger block cursor), everything moved a bit further down. Do you mind finding what caused that change and reverse it? (Given that the whole code appears different due to the tab size change I cannot tell what exactly caused it.)
  • As I draw the page expands in size. As if the block fonts have different height than the spaces (&nbsp) . Can you find what is causing it and fix it.
  • Make sure that you also run make lint. I see lots of lint errors.
  • Finally when you make comments in githib dont't use it like a chat or IRC. (ie single line per enter). Group together your lines in a single comment. If you want to say more on a comment you have made already, edit that comment and add more lines. (# of comments in a issue is used as an indication of activity)

My skype id is tsatalos. It may be easier to connect with me directly there if you think that some of the above comments are not clear.

@GulinSS
Copy link
Contributor

GulinSS commented May 1, 2013

Thanks for feedback! All your instructions will be applied.

Some updates: https://github.com/GulinSS/boxchareditor/commits/gh-pages
Improved link engine.

Draft works, play :-)

@ogt
Copy link
Owner Author

ogt commented May 1, 2013

I just played with it. More of the transformations work now.
Keep in mind that that when I erase I look at the neighboring cells and I recalculate them, it leaves no hanging "tails" over the erased path. Still some key things don't work, like drawing a rectangle...

You should probably revert index.html to the original - no need to be messing with the HTML in this issue..
The only files that should need to be updated is blocklines.js and a tiny amount of drawingenging.js (unless if you want to refactor simplelines.js to make it consistent with the matrix transformation method.

Can you connect with me on skype to iterate a bit faster? My skype id is tsatalos.

@GulinSS
Copy link
Contributor

GulinSS commented May 1, 2013

You should probably revert index.html

Html page should contains Content-Type, I added this. Probably now HTML-page looks like it was.

Still some key things don't work, like drawing a rectangle.

It works but tricky: you should delete a corner and press left/right on blank corner to get nice close.

@ogt ogt closed this as completed May 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants