W3C home > Mailing lists > Public > www-style@w3.org > February 2016

Re: box-shadow offset when transform:rotate is used

From: Christian Mayer <mail@ChristianMayer.de>
Date: Fri, 19 Feb 2016 15:50:38 +0100
To: Xidorn Quan <quanxunzhen@gmail.com>, "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style list <www-style@w3.org>
Message-ID: <56C72BBE.6010907@ChristianMayer.de>
Am 19.02.2016 um 09:41 schrieb Xidorn Quan:
> On Fri, Feb 19, 2016 at 3:39 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> On Thu, Feb 18, 2016 at 1:55 PM, Christian Mayer <mail@christianmayer.de> wrote:
>>> So is there a way (or can it be added?) to make the offset always work
>>> in screen coordinates and not in element coordinates?
>>> E.g. by adding an additional keyword?
>>>
>>> Like
>>>
>>>   box-shadow: screen 2px 3px 4px #000
>>>   transform: translate(10px, 20px) rotate(40deg)

> Hmmm... I didn't say his solution is complicated... I just didn't
> think the "screen" looks like the right word here, so I ignored
> this... 

I'm not fixed on the word "screen", it just seemed fitting to me as it
described which coordinate system should be used.
It could also be "post-transform", "notransform", "late", ...

> But it seems my proposal was almost identical to his
> otherwise, except how I described it.

I didn't know there was a different proposal. Do you have a link?

>> If handling just the rotation is fine, though, then the nearish future
>> with variables and custom functions will help in handling this -
>> someone can write a custom function to translate a length+angle into
>> two axis-aligned offsets, and then you can use a custom property to
>> share the rotation value between the box-shadow and the transform
>> without having to duplicate them.
> 
> Actually, I did say this is way too complicated for such simple usecase.

As this is a usecase that beginners should also be able to handle, I
also think that forcing the CSS creator to use trig is too sophisticated.
(In my application I'm using enough trigonometry in the JavaScript part,
for me it'd be easy. But there are many others out there with less maths
background)

Chris
Received on Friday, 19 February 2016 14:51:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:00 UTC