mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-12 23:35:38 +08:00
926a8aaf8a
* feat: tooltip round arrow * chore: update demo * docs: update docs * feat: rounded arrow in Tooltip/Popover/Popconfirm/Dropdown/RangePicker * chore: code clean * fix: fill gap * chore: code clean * chore: raise css bundle size * fix: arrow style * feat: use full path * test: update snapshot * perf: hack firefox * perf: more magic position * perf: RangePicker's arrow position * chore: bump rc-picker version * fix: arrow position
38 lines
1.6 KiB
Plaintext
38 lines
1.6 KiB
Plaintext
.roundedArrow(@width, @outer-radius, @bg-color: var(--antd-arrow-background-color)) {
|
|
@corner-height: unit(((@outer-radius) * (1 - 1 / sqrt(2))));
|
|
|
|
@width-without-unit: unit(@width);
|
|
@outer-radius-without-unit: unit(@outer-radius);
|
|
@inner-radius-without-unit: unit(@border-radius-base);
|
|
|
|
@a-x: @width-without-unit - @corner-height;
|
|
@a-y: 2 * @width-without-unit + @corner-height;
|
|
@b-x: @a-x + @outer-radius-without-unit * (1 / sqrt(2));
|
|
@b-y: 2 * @width-without-unit;
|
|
@c-x: 2 * @width-without-unit - @inner-radius-without-unit;
|
|
@c-y: 2 * @width-without-unit;
|
|
@d-x: 2 * @width-without-unit;
|
|
@d-y: 2 * @width-without-unit - @inner-radius-without-unit;
|
|
@e-x: 2 * @width-without-unit;
|
|
@e-y: @f-y + @outer-radius-without-unit * (1 / sqrt(2));
|
|
@f-x: 2 * @width-without-unit + @corner-height;
|
|
@f-y: @width-without-unit - @corner-height;
|
|
|
|
border-radius: 0 0 @border-radius-base 0;
|
|
pointer-events: none;
|
|
|
|
&::before {
|
|
position: absolute;
|
|
top: -@width;
|
|
left: -@width;
|
|
width: @width * 3;
|
|
height: @width * 3;
|
|
background: linear-gradient(to left, @bg-color 50%, @bg-color 50%) no-repeat ceil(-@width + 1px)
|
|
ceil(-@width + 1px); // Hack firefox: https://github.com/ant-design/ant-design/pull/33710#issuecomment-1015287825
|
|
content: '';
|
|
clip-path: path(
|
|
'M @{a-x} @{a-y} A @{outer-radius-without-unit} @{outer-radius-without-unit} 0 0 1 @{b-x} @{b-y} L @{c-x} @{c-y} A @{inner-radius-without-unit} @{inner-radius-without-unit} 0 0 0 @{d-x} @{d-y} L @{e-x} @{e-y} A @{outer-radius-without-unit} @{outer-radius-without-unit} 0 0 1 @{f-x} @{f-y} Z'
|
|
);
|
|
}
|
|
}
|