W3C home > Mailing lists > Public > www-svg@w3.org > June 2018

Fwd: Rectangle height and width

From: Fuzzy Ma <ulima.ums@gmail.com>
Date: Mon, 11 Jun 2018 18:39:40 +0200
Message-ID: <CAKKaHAviMeo82Cz2rtiQE+=FKe1Au5KrKzvmJeA+3gFK5VD=-w@mail.gmail.com>
To: www-svg <www-svg@w3.org>
I realised that I didnt use the answer all button so here my mail for
everyone again:

I remember, that I came across the same issue and therefore I must kinda
agree, that this would make coding a little bit easier at some points, BUT:

In my opinion allowing negative widths and heights does not make sense.
There is nothing such negative space as well as their is nothing like
negative time.
When you have a house you dont say it has a height of -2m when you actually
want to say that it has a basement which is 2m in depths (which is
basically a change in the reference system but the value stays positive).

For positioning it makes sense to allow negative values because we define
an arbitrary reference which is most likely the upper left browser window.
Same is true for time where we use 1970 as reference (start of unix time)
(or others).

When we start allowing mathematical constructs like this, nothing is
stopping us from allowing infinite or negative radii which make perfectly
sense in a mathematical environment but shouldnt be allowed in svg.

As a last point I would like to mention, that we would again introduce
something which makes svg harder to understand while not even reducing the
filesize or adding much other benefit. Removing the restrictions here would
furtermore lead to svgs popping up which cannot be understood by old
parsers anymore which injects yet another incompatbility.
On the other side, solving the problem of negative width or height in any
programming language is as simple as:


    // analog for y and height
    x = Math.min(x1, x2)
    width = Math.abs(x1 - x2)

So I dont see a problem when generating svgs with other languages

Best regards
Ulrich-Matthias
(svgjs.com)

2018-06-10 12:26 GMT+02:00 Steven Pemberton <steven.pemberton@cwi.nl>:

> On Sat, 09 Jun 2018 18:42:24 +0200, Amelia Bellamy-Royds <
> amelia.bellamy.royds@gmail.com> wrote:
>
> While I agree with you both that it would be a mathematical convenience to
> define negative width/height as an inversion of the rectangle, but I think
> it is far too late to change this now. The restriction on negative numbers
> has been there since the beginning and is supported universally.
>
> But it's a restriction, not a feature. You don't support a restriction,
> but adhere to it. By lifting the restriction you don't introduce any
> incompatibilities: old SVG files still render properly; however, by lifting
> it you do add new possibilities, and make life easier for SVG authors.
>
> Furthermore, with SVG 2 conversion of width and height to presentation
> attributes with matching CSS properties means that we need to match the
> syntax used for the CSS properties, which have the same restriction.
>
> Matching the syntax doesn't require matching the semantics surely.
>
> Best wishes,
>
> Steven Pemberton
>
>
> In contrast, the startOffset restriction was changed much earlier on, and
> didn't affect any other specifications.
>
> ~Amelia
>
> On 9 June 2018 at 08:20, David Dailey <ddailey@zoominternet.net> wrote:
>
>> Fwiw, I kinda like the use case. It makes sense to me. (which sometimes
>> proves to be a mark of doom for suggestions SVG, so apologies if my
>> weighing in jinxes the idea.)
>>
>> I would concur that "there are probably other places in the spec where
>> negative values are unnecessarily restricted."
>>
>> I remember back around 2008 strolling through Nuremberg with Eric
>> Dahlstrom and complaining that this example:
>> http://srufaculty.sru.edu/david.dailey/svg/newstuff/textpath1.svg didn't
>> work as I thought it should, because the value of startoffset on a textPath
>> was confined to being non-negative. He replied that no one had quite
>> imagined doing that particular thing, but that it made sense. Within a few
>> years this example ran in all browsers (this was pre-IE-SVG, so one used
>> the Adobe plugin).
>>
>> Cheers
>> David
>>
>> -----Original Message-----
>> From: Steven Pemberton [mailto:steven.pemberton@cwi.nl]
>> Sent: Saturday, June 09, 2018 7:43 AM
>> To: www-svg@w3.org
>> Subject: Rectangle height and width
>>
>> https://svgwg.org/svg2-draft/shapes.html#RectElement
>>
>> "The width and height properties define the overall width and height of
>> the rectangle. A negative value for either property is illegal and must
>> be
>> ignored as a parsing error."
>>
>> Please please please fix this! There is absolutely no abstract
>> justification for saying a rectangle cannot have a negative height (or
>> width). It's just the same dimension in the other direction!
>>
>> If you're interested in a very natural use case, please see
>> https://homepages.cwi.nl/~steven/xforms/histogram.html
>>
>> (There are probably other places in the spec where negative values are
>> unnecessarily restricted, but this is the one that I ran into in the
>> above
>> example).
>>
>> Best wishes,
>>
>> Steven Pemberton
>> CWI, Amsterdam
>>
>>
>>
>>
>>
>
>
>
>
Received on Monday, 11 June 2018 16:40:07 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:55:14 UTC