Hacker News new | ask | show | jobs
by joshribakoff 3172 days ago
I built an editor based on canvas and DOM, eventually you run into problems with canvas that the dom already solves. At that point your options are reinvent the wheel (for example write logic to draw tables with lines and the drawing API), or float DOM elements over the canvas. The latter gets hairy with z index as canvases block mouse and touch events from "passing through" to elements behind them. There are of course hacks like invisible dom elements that toggle pointer-events on the canvas, but you have to ask yourself if the problem you're trying to solve is really worth these hacks/reinventing the wheel. If you're not letting users draw with a paintbrush, you probably don't need canvas but that's just my opinion. Canvas is also a bit of a leaky abstraction in some cases. For example it essentially uses the same text layout algorithms as HTML, deciding on its own where to line wrap. Line wraps can jump around when resizing the browser. It is not vectorized text so it doesn't work for all types of designs
1 comments

"but that's just my opinion", Good opinion regardless.

To keep the line wrapping consistent with how the designer sees it in the application, wrapping is handled by the app itself, it doesn't rely on the text layout algorithm HTML uses. Consistency is the priority.

> To keep the line wrapping consistent with how the designer sees it in the application

From my perspective as a low-vision person who often uses magnification, this is an unwelcome invasion of the one-size-fits-all mindset from print design. Let my device reflow the text. Designers just have to embrace this newer, more dynamic medium.

Edit: Besides accessibility, what about the variety of screen sizes we have these days? This isn't the 90s.

Edit 2: To jamarante and others that think a canvas-based tool like this is a good idea, I recommend this article for a different approach to web design: https://www.chenhuijing.com/blog/a-better-web-design-process...

I don't like being negative, but, having given it a day's thought and read more of the comments, I firmly believe that what you're doing is a step backward for the Web. That doesn't mean that I think Web designers should write HTML and CSS by hand. Do give them better tools, but don't try to turn the Web into a new PDF.

"I don't like being negative" That's fine that article was a good read. If you pay attention to how the breakpoint system works it allows your designs to be fluid. What I meant when I mentioned that text wrapping is consistent is that it will be consistent at the breakpoints (I like to think of them more like snapshots of the current layout that is being constrained at a specific width), outside of the breakpoints the text and other elements in the page will adapt accordingly to containers. In that case it will not be perfect outside of the breakpoint lines. Hope that answers your question.
Thanks, I didn't know about the breakpoint system. I'm glad that "consistent" in this case doesn't mean fixed width, like PDF or bad 90s websites. I'm sorry I over-reacted.
Right, its not the 90s but lots of people still print & still will for a long time. Plus consistent designs doesn't have to imply print, maybe you're targeting another fixed height medium like a giant electronic billboard.
Haha no worries. Don't hold back on the feedback.