W3C home > Mailing lists > Public > www-style@w3.org > November 2015

Re: [css-round-display] polar-pos part of abs-pos

From: Brad Kemper <brad.kemper@gmail.com>
Date: Sun, 15 Nov 2015 16:55:19 -0800
Cc: Jihye Hong <jh.hong@lge.com>, Florian Rivoal <florian@rivoal.net>
Message-Id: <8E824031-16C7-4788-A2F7-79A99C84A528@gmail.com>
To: www-style list <www-style@w3.org>
Just sending this to the list again, because it relates to the need for ‘polar-origin’ that we discussed in the last telecon.

Read the discussion below, and maybe the replies, but the basics are this:

1. Instead of having ‘position: polar’, just make ‘polar-angle’ and ‘polar-distance’ work similarly to ’top’, right’, ‘bottom’. and ‘left’, in that they would work within ‘position: absolute | fixed | relative’.

2. Just as a non-auto value for ’top’, right’, ‘bottom’. and ‘left’ is what activates those properties for positioning, so would a non-auto value of ‘polar-distance’ (which means ‘auto’ would be its initial value). When non-auto, the polar-distance is measured from the center for absolute or fixed positions, or from its static position for relative positions.

3. ’top’, right’, ‘bottom’. and ‘left’ could combine with ‘polar-distance’ to determine the final placement, thus negating the need for ‘polar-origin’.

———

An alternative for #2 above, is to have ‘center-x’, ‘center-y’, and ‘center’ properties for positioning, similar to ’top’, right’, ‘bottom’. and ‘left’, but positioning the center of the element instead of an edge. So, ‘center-x:0’ would position the center of the item aligned on the left edge of the containing block, ‘center-y:100%’ would position the center of the item aligned on the bottom edge of the containing block, and so on. ‘Center’ would be shorthand for ‘center-x’ and ‘center-y’, so that ‘center: 0 100%’ would position the center of the item to align with the bottom left corner of the containing block. ‘Center:50%’ would be short for ‘center:50% 50%’, and would put the item dead center of its containing block. If you had non-auto ’center-x’ and ‘left’ on the same element, their positions would add together (same for ‘center-y’ and ’top’). So, ‘center-x:50%; left:10px’ would put the center of the item 10px to the right of center. In relative positioning, ‘center-x’ would have the same effect as ‘left’, and ‘center-y’ would have the same effect as ’top’.

Abspos centering would be very useful in general. It isn’t easy to do now in CSS when you don’t know the height of the item ahead of time. Having a slider in which the pointer is centered on a percentage position would also be easier. 

The proposal above for polar positioning, above, doesn’t depend on a ‘center’ property, but step #2 wouldn’t be necessary if we did have ‘center’ (you’d just put the center where you want it, and use polar-distance and polar-angle to move it from there), and we don’t really need two ways to do abspos centering.


> On Oct 15, 2015, at 11:25 PM, Brad Kemper <brad.kemper@gmail.com> wrote:
> 
> 
> 
> 
> 
> Sent from my iPad
> On Oct 15, 2015, at 10:21 PM, Florian Rivoal <florian@rivoal.net> wrote:
> 
>>> 
>>> On 16 Oct 2015, at 07:51, Brad Kemper <brad.kemper@gmail.com> wrote:
>>> 
>>> 
>>> 
>>> 
>>> Brad Kemper
>>> 
>>> On Oct 15, 2015, at 12:59 AM, Jihye Hong <jh.hong@lge.com> wrote:
>>> 
>>>>> On Oct 9, 2015, at 10:44 AM, Brad Kemper <brad.kemper@gmail.com> wrote:
>>>>> 
>>>>> What I suggested was: don't make 'polar' a separate value of 'position'.
>>>> Instead, let 
>>>>> 'polar-angle' and 'polar-distance' combine with positions absolute, fixed,
>>>> and relative, 
>>>>> in the same way that left, right, top, and bottom do. The effects of left,
>>>> right, top, bottom,
>>>>> polar-angle, and polar-distance would be cumulative, so if you wanted a
>>>> horizontal or vertical
>>>>> offset, you would usually use 'top' and 'left' for that.
>>>> 
>>>> We also had considered about the method similar to your suggestion. 
>>>> But, I'm not sure that the coordination system is decided by the
>>>> polar-related properties not by the position: polar. 
>>> 
>>> I'm suggesting it could be. 
>>> 
>>>> When using position: polar, we clearly know that the element is positioned
>>>> based on the center point of the containing block. 
>>> 
>>> I guess what I am suggesting is that if the value of 'polar-distance' is anything other than 'auto', then the element is positioned based on the center point of the containing block.
>> 
>> If I am following you correctly, if polar-distance is anything other than auto on an absolutely (or fixed) positioned element, then it is positioned from the center of the containing block. But if it is on a relatively positioned element, then it would be from where the center of the element would have been if statically positioned (or equivalently relatively positioned with top/left/bottom/right left to their initial value).
> 
> Yes. Good point.
> 
>> And on a statically positioned element, it does nothing (just like top/right/bottom/left).
>> 
>> Right?
> 
> Right.
> 
>> That makes sense to me with polar-distance as a length,
> 
> Great! 
> 
>> but I seems that percentage polar distances would only makes sense when used with absolutely/fixed positioned element, not with relative, so we'd probably have to make them the same as 0 in that case. Which is probably fine. Or did you mean something else?
> 
> Hmm. I hadn't given that much thought. I would expect it to be consistent with top, right, bottom, left, which apparently use percentages the same way as absolutely positioning, as a percentage of the containing block (although I've never personally needed to use rel-pos that way). So I guess I'd measure what the polar-distance would be if it was abs-pos, and then move it that much.
> 
> But that's more of a "purity" consideration than a practical one, from where I stand. Otherwise I don't feel strongly about it yet.
> 
>>> (Alternative proposal: if the value of 'polar-angle' is anything other than 'auto', then the element is positioned based on the center point of the containing block.)
>> 
>> Makes more sense to me with polar-distance than with polar-angle.
> 
> Yes, it feels a little more natural to me that way too.
> 
>>> So it is still being determined by a value, but on a different property than what the draft says. 
>>> 
>>> Or... introduce 'center' as another property, so that 'center: 50%' would center an element. 
>> 
>> That sounds more confusing, and not obviously more useful.
> 
> Does it? OK. Well, it would be useful in general to be able to abs-pos center an element, or even just position an element anywhere by the center of the element, instead of by the edges. And even to have 'center' be a shorthand for 'center-x' and 'center-y' (or logical equivalent). So this is really a whole other thing, but if we had it, then it would fit nice with the idea of then applying 'polar-*' measurements  (and maybe trbl measurements too) from that point without further need for a way to measure coordinates from the center. 
> 
> I realize this would expand the scope of what this spec is trying to accomplish. But I think it would be pretty useful beyond round displays in a way that still works well with round displays.
Received on Monday, 16 November 2015 00:55:53 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:58 UTC