[html5] (no subject)

John S. Urban urbanjost at comcast.net
Tue Jan 6 04:53:40 PST 2009

> Percents aren't allowed currently... what do browsers do with percentage
> values? Is it useful?

As most browsers seem to implement them,percent values are useful in that 
you do not have to redo the coordinates for
different sizes of the same image. So if you have a small map for small 
screens, and a large one for accessibility
purposes or for larger screens, the same <MAP> can be used without re-doing 
the coordinates; whereas pixel values
(currently) need redone for each pixmap file.

Now that JavaScript can easily be used to allow you to dynamically resize 
your images, it would be nice if
the browsers interpreted the percent units to be percentages of the 
DISPLAYED size, not the image file's
units. That would mean you would not have to keep a seperate image file for 
each  display size.

Let's say I have an image of the USA outlining each state. I can easily use 
JavaScript to make the image
change size as my browser window changes size. This means it displays 
completely on any size display,
and can be enlarged easily by the user just maximizing his browser window, 
for example. But the map is
obviously only good for one set of WIDTH= HEIGHT= values if in pixels 
(assuming the values do not get rescaled).
But  making percent units be relative to the DISPLAYED image size means that 
<IMG> is much more compatible
with the new abilities to resize images dynamically.

It seems an oversight that browsers don't do this already. This is probably 
because there was no way to resize the
images dynamically at first. So percentage units allowed one map for many 
different sizes of the same image;  and
it was usually best to actually have a file that matched the WIDTH= and 
HEIGHT= values used in the <IMG>.

I find this behavior useful enough to have made a limited-case JavaScript 
function to supply the desired behavior,
which I use in several  projects. But this (seemingly simple?) behavior 
would make a generic, clean and easily
understood way to rescale maps to new images sizes.  I meant the example URI 
to show the usefulness of such
a feature; but I might have made the image too simple. The method shown in 
the example has proven to be very
useful with floor plans, maps of geographic locations, ... .

PS:  I have been experimenting with replacing the image maps with <CANVAS> 
elements, but found I had to create
my own routines to detect if I was in a polygon or not to do so. SVG 
supports the features I need to make a scaleable
vector-based drawing with clippable regions, but requires external files and 
so on. Am I correct, or is there a way to
use  MAP and AREA with a CANVAS ? If there is, that would be another reason 
to support scaling coordinates; as
vector drawings are very well suited to dynamic rescaling (and zooming and 
clipping, for that matter).

PSS: If you make multiple files displaying differently-sized images of the 
same "picture", and put a single <MAP> in
another file, experience shows some browsers seem to have trouble with that. 
If the URI is anything other than a "#NAME" reference,
some browsers fail. This means it is much more work to update an imagemap 
used in multiple documents.

----- Original Message ----- 
From: "Ian Hickson" <ian at hixie.ch>
To: "John S. Urban" <urbanjost at comcast.net>
Cc: "Samer E. Ziadeh" <samerziadeh at gmail.com>; "Dorde Nenezic" 
<djolenene at yahoo.co.uk>; <help at lists.whatwg.org>
Sent: Tuesday, January 06, 2009 6:31 AM
Subject: Re: [html5] (no subject)

> On Mon, 5 Jan 2009, John S. Urban wrote:
>> 2) Remembering this, I looked at the HTML5 spec. to see how it described 
>> the use of percent units for coordinates.
>> A) I found it said coordinates could only be a list of integers as 
>> described in Does this mean percent coordinates are not allowed
>> in HTMl5?
> That is correct.
>> B) As I read it states in the first paragraph that the only 
>> allowed
>> delimiter is a comma; and specifically states spaces are not allowed.
> Right.
>> But in rule 6 of it seems to imply a space, comma, or semi-colon
>> is an allowed delimiter in a "List of Integers".
> Not an allowed delimiter, but it is true that those other characters are
> to be treated as delimiters by the browsers.
>> So .. did I miss something or are percent-units no longer allowed as 
>> coordinates? What are the delimiters allowed in a list of integers? And, 
>> I
>> wish percent units scaled to the displayed image size ( as I mentioned in
>> http://home.comcast.net/~urbanjost/semaphore.html ). If percent units are 
>> permitted, I think it would be worth mentioning what they are a percent
>> of (image file units or displayed image size units).
> Percents aren't allowed currently... what do browsers do with percentage
> values? Is it useful?
> -- 
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.' 

More information about the Help mailing list