These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:19 pm Advanced search

LineWidth and Implementing a Hairwidth Property

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

LineWidth and Implementing a Hairwidth Property

Postby spmorr02 » Thu Jan 21, 2010 6:35 pm

I am working for a company who is currently trying to reproduce engineering drawings made in AutoCad within the canvas tag as a way to step away from the legacy way of doing it using Java and being stuck in IE.

Every coordinate in these drawings is defined in inches which is saying something when some of these drawings are miles wide.

This obviously means that the drawings have to be scaled considerably. The problem is that a line with a lineWidth of 1 after being scaled 5x's has a lineWidth of 5.

I understand the importance of not relying on pixel measurements for everyday use. However this becomes a problem for users who are trying to implement canvas for data, such as a map, chart, or engineering drawing which sometime need this exact specification.

What I am suggesting is implementing something like a hairwidth property. In other graphics programs this means being able to set a lineWidth, of for example 1 px, and even after scaling this line remains 1 px wide.

Still other graphics programs implement this feature if lineWidth is set equal to 0 rather than just ignoring it.

I would really just like to know other peoples opinions on this subject and the feasibility of this being added in the future.
spmorr02
<h5>
 
Posts: 19
Joined: Thu Jan 21, 2010 5:37 pm
Location: Louisville, Kentucky

Update

Postby spmorr02 » Wed Jan 27, 2010 4:58 pm

So I recently found out that the latest version of Chrome implements the canvas tag and the linewidth property in the exact way I mentioned. This isn't a huge surprise when you consider that they use canvas for some of the exact purposes I mentioned in my first post.

Hopefully, the other browsers will follow in their footsteps. I thought the whole point of <canvas> tag was standardization...
spmorr02
<h5>
 
Posts: 19
Joined: Thu Jan 21, 2010 5:37 pm
Location: Louisville, Kentucky

Postby zcorpan » Wed Jan 27, 2010 10:53 pm

Could you show a demo page or some sample code that does what you want in chrome but not in other browsers?
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby spmorr02 » Thu Jan 28, 2010 12:52 pm

http://www.hascanvas.com/shaun is one example. Click and drag up and down to see the effects of zooming on the line drawn across the canvas. Do this in the latest versions of FF and Chrome and you will see how they treat the line differently.

But really you could draw a line on any canvas and then scale it and see the same thing.
spmorr02
<h5>
 
Posts: 19
Joined: Thu Jan 21, 2010 5:37 pm
Location: Louisville, Kentucky

Postby zcorpan » Thu Jan 28, 2010 1:39 pm

I don't see much of a difference between Opera, Firefox and Chrome. When I zoom out enough the line becomes thinner than 1px, and when I zoom in enough it becomes wider than 1px.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby spmorr02 » Thu Jan 28, 2010 2:04 pm

Well that is what happens in FF 3.6, Safari 4.0.4, and Opera 10.10

In Chrome 4.0.249.78, the line should not be getting thicker than 1 px. No matter how much I zoom in, it remains 1 px wide

Which is what I require for the project I am working on and hoping that the other browsers will either follow suit or add at least this ability as an option
spmorr02
<h5>
 
Posts: 19
Joined: Thu Jan 21, 2010 5:37 pm
Location: Louisville, Kentucky

Postby zcorpan » Thu Jan 28, 2010 8:11 pm

In 4.0.249.49 (which is the latest on dev channel on mac) it gets thicker than 1px when I zoom in.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby spmorr02 » Thu Jan 28, 2010 8:15 pm

Hmm..I am running it on windows. All of my previous versions of chrome have done the same thing though so its not something new to my version, just a bug in the windows version i suppose.
spmorr02
<h5>
 
Posts: 19
Joined: Thu Jan 21, 2010 5:37 pm
Location: Louisville, Kentucky

Postby zcorpan » Mon Feb 01, 2010 7:01 pm

Yep I see it on windows. Seems like a bug. Maybe you could report it? http://code.google.com/p/chromium/issues/entry or https://bugs.webkit.org/

In any case, you should bring your use case to the WHATWG list or W3C bugzilla and ask for this feature.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby spmorr02 » Mon Feb 01, 2010 8:12 pm

I have reported it at Bug Report

and how would I go about proposing my use case?
spmorr02
<h5>
 
Posts: 19
Joined: Thu Jan 21, 2010 5:37 pm
Location: Louisville, Kentucky

Postby zcorpan » Wed Feb 03, 2010 12:19 pm

http://www.whatwg.org/mailing-list#specs (need to subscribe before posting)

or

http://www.w3.org/Bugs/Public/enter_bug ... +spec+bugs (need to create an account)

or you could send an email to public-html-comments@w3.org (no need to subscribe)
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby spmorr02 » Fri Feb 05, 2010 1:05 pm

Update: For anyone who is interested. This idea has been suggested to the WHATWG and is being considered, however, additions to the specification are being put on hold until more browsers fully implement it as is.

and I'd like to say thanks to zcorpan for confirming the bug and pointing me in the right direction
spmorr02
<h5>
 
Posts: 19
Joined: Thu Jan 21, 2010 5:37 pm
Location: Louisville, Kentucky


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest