Merge pull request #1054 from robintown/local-feed-contrast
Use a more noticeable shadow when displaying one tile on top another
This commit is contained in:
commit
1c9b2a24d9
5 changed files with 19 additions and 5 deletions
|
@ -245,6 +245,7 @@ export const NewVideoGrid: FC<Props> = ({
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
scale: 0,
|
scale: 0,
|
||||||
shadow: 1,
|
shadow: 1,
|
||||||
|
shadowSpread: 0,
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
|
|
|
@ -51,6 +51,7 @@ export interface TileSpring {
|
||||||
opacity: number;
|
opacity: number;
|
||||||
scale: number;
|
scale: number;
|
||||||
shadow: number;
|
shadow: number;
|
||||||
|
shadowSpread: number;
|
||||||
zIndex: number;
|
zIndex: number;
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
|
@ -892,6 +893,8 @@ export function VideoGrid({
|
||||||
// Whether the tile positions were valid at the time of the previous
|
// Whether the tile positions were valid at the time of the previous
|
||||||
// animation
|
// animation
|
||||||
const tilePositionsWereValid = tilePositionsValid.current;
|
const tilePositionsWereValid = tilePositionsValid.current;
|
||||||
|
const oneOnOneLayout =
|
||||||
|
tiles.length === 2 && !tiles.some((t) => t.presenter || t.focused);
|
||||||
|
|
||||||
return (tileIndex: number) => {
|
return (tileIndex: number) => {
|
||||||
const tile = tiles[tileIndex];
|
const tile = tiles[tileIndex];
|
||||||
|
@ -911,12 +914,14 @@ export function VideoGrid({
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
zIndex: 2,
|
zIndex: 2,
|
||||||
shadow: 15,
|
shadow: 15,
|
||||||
|
shadowSpread: 0,
|
||||||
immediate: (key: string) =>
|
immediate: (key: string) =>
|
||||||
disableAnimations ||
|
disableAnimations ||
|
||||||
key === "zIndex" ||
|
key === "zIndex" ||
|
||||||
key === "x" ||
|
key === "x" ||
|
||||||
key === "y" ||
|
key === "y" ||
|
||||||
key === "shadow",
|
key === "shadow" ||
|
||||||
|
key === "shadowSpread",
|
||||||
from: {
|
from: {
|
||||||
shadow: 0,
|
shadow: 0,
|
||||||
scale: 0,
|
scale: 0,
|
||||||
|
@ -974,10 +979,14 @@ export function VideoGrid({
|
||||||
opacity: remove ? 0 : 1,
|
opacity: remove ? 0 : 1,
|
||||||
zIndex: tilePosition.zIndex,
|
zIndex: tilePosition.zIndex,
|
||||||
shadow: 1,
|
shadow: 1,
|
||||||
|
shadowSpread: oneOnOneLayout && tile.item.isLocal ? 1 : 0,
|
||||||
from,
|
from,
|
||||||
reset,
|
reset,
|
||||||
immediate: (key: string) =>
|
immediate: (key: string) =>
|
||||||
disableAnimations || key === "zIndex" || key === "shadow",
|
disableAnimations ||
|
||||||
|
key === "zIndex" ||
|
||||||
|
key === "shadow" ||
|
||||||
|
key === "shadowSpread",
|
||||||
// If we just stopped dragging a tile, give it time for the
|
// If we just stopped dragging a tile, give it time for the
|
||||||
// animation to settle before pushing its z-index back down
|
// animation to settle before pushing its z-index back down
|
||||||
delay: (key: string) => (key === "zIndex" ? 500 : 0),
|
delay: (key: string) => (key === "zIndex" ? 500 : 0),
|
||||||
|
|
|
@ -22,6 +22,8 @@ limitations under the License.
|
||||||
height: var(--tileHeight);
|
height: var(--tileHeight);
|
||||||
--tileRadius: 8px;
|
--tileRadius: 8px;
|
||||||
border-radius: var(--tileRadius);
|
border-radius: var(--tileRadius);
|
||||||
|
box-shadow: rgba(0, 0, 0, 0.5) 0px var(--tileShadow)
|
||||||
|
calc(2 * var(--tileShadow)) var(--tileShadowSpread);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ interface Props {
|
||||||
opacity?: SpringValue<number>;
|
opacity?: SpringValue<number>;
|
||||||
scale?: SpringValue<number>;
|
scale?: SpringValue<number>;
|
||||||
shadow?: SpringValue<number>;
|
shadow?: SpringValue<number>;
|
||||||
|
shadowSpread?: SpringValue<number>;
|
||||||
zIndex?: SpringValue<number>;
|
zIndex?: SpringValue<number>;
|
||||||
x?: SpringValue<number>;
|
x?: SpringValue<number>;
|
||||||
y?: SpringValue<number>;
|
y?: SpringValue<number>;
|
||||||
|
@ -79,6 +80,7 @@ export const VideoTile = forwardRef<HTMLElement, Props>(
|
||||||
opacity,
|
opacity,
|
||||||
scale,
|
scale,
|
||||||
shadow,
|
shadow,
|
||||||
|
shadowSpread,
|
||||||
zIndex,
|
zIndex,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
|
@ -141,9 +143,6 @@ export const VideoTile = forwardRef<HTMLElement, Props>(
|
||||||
style={{
|
style={{
|
||||||
opacity,
|
opacity,
|
||||||
scale,
|
scale,
|
||||||
boxShadow: shadow?.to(
|
|
||||||
(s) => `rgba(0, 0, 0, 0.5) 0px ${s}px ${2 * s}px 0px`
|
|
||||||
),
|
|
||||||
zIndex,
|
zIndex,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
|
@ -152,6 +151,8 @@ export const VideoTile = forwardRef<HTMLElement, Props>(
|
||||||
// but React's types say no
|
// but React's types say no
|
||||||
"--tileWidth": width?.to((w) => `${w}px`),
|
"--tileWidth": width?.to((w) => `${w}px`),
|
||||||
"--tileHeight": height?.to((h) => `${h}px`),
|
"--tileHeight": height?.to((h) => `${h}px`),
|
||||||
|
"--tileShadow": shadow?.to((s) => `${s}px`),
|
||||||
|
"--tileShadowSpread": shadowSpread?.to((s) => `${s}px`),
|
||||||
}}
|
}}
|
||||||
ref={ref as ForwardedRef<HTMLDivElement>}
|
ref={ref as ForwardedRef<HTMLDivElement>}
|
||||||
data-testid="videoTile"
|
data-testid="videoTile"
|
||||||
|
|
|
@ -47,6 +47,7 @@ interface Props {
|
||||||
opacity?: SpringValue<number>;
|
opacity?: SpringValue<number>;
|
||||||
scale?: SpringValue<number>;
|
scale?: SpringValue<number>;
|
||||||
shadow?: SpringValue<number>;
|
shadow?: SpringValue<number>;
|
||||||
|
shadowSpread?: SpringValue<number>;
|
||||||
zIndex?: SpringValue<number>;
|
zIndex?: SpringValue<number>;
|
||||||
x?: SpringValue<number>;
|
x?: SpringValue<number>;
|
||||||
y?: SpringValue<number>;
|
y?: SpringValue<number>;
|
||||||
|
|
Loading…
Reference in a new issue