mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: Add 'Fine' stroke width option for freehand tool
This commit is contained in:
parent
b5d60973b7
commit
1c0c6adbf3
4 changed files with 31 additions and 2 deletions
|
@ -1033,10 +1033,18 @@ export function getFreeDrawSvgPath(element: ExcalidrawFreeDrawElement) {
|
||||||
? element.points.map(([x, y], i) => [x, y, element.pressures[i]])
|
? element.points.map(([x, y], i) => [x, y, element.pressures[i]])
|
||||||
: [[0, 0, 0.5]];
|
: [[0, 0, 0.5]];
|
||||||
|
|
||||||
|
let size;
|
||||||
|
if (element.strokeWidth === 0.5) {
|
||||||
|
size = 1.5;
|
||||||
|
} else {
|
||||||
|
// existin stroke widths
|
||||||
|
size = element.strokeWidth * 4.25;
|
||||||
|
}
|
||||||
|
|
||||||
// Consider changing the options for simulated pressure vs real pressure
|
// Consider changing the options for simulated pressure vs real pressure
|
||||||
const options: StrokeOptions = {
|
const options: StrokeOptions = {
|
||||||
simulatePressure: element.simulatePressure,
|
simulatePressure: element.simulatePressure,
|
||||||
size: element.strokeWidth * 4.25,
|
size: size,
|
||||||
thinning: 0.6,
|
thinning: 0.6,
|
||||||
smoothing: 0.5,
|
smoothing: 0.5,
|
||||||
streamline: 0.5,
|
streamline: 0.5,
|
||||||
|
|
|
@ -121,6 +121,7 @@ import {
|
||||||
ArrowheadCrowfootIcon,
|
ArrowheadCrowfootIcon,
|
||||||
ArrowheadCrowfootOneIcon,
|
ArrowheadCrowfootOneIcon,
|
||||||
ArrowheadCrowfootOneOrManyIcon,
|
ArrowheadCrowfootOneOrManyIcon,
|
||||||
|
StrokeWidthFineIcon,
|
||||||
} from "../components/icons";
|
} from "../components/icons";
|
||||||
|
|
||||||
import { Fonts } from "../fonts";
|
import { Fonts } from "../fonts";
|
||||||
|
@ -491,6 +492,12 @@ export const actionChangeStrokeWidth = register({
|
||||||
<ButtonIconSelect
|
<ButtonIconSelect
|
||||||
group="stroke-width"
|
group="stroke-width"
|
||||||
options={[
|
options={[
|
||||||
|
{
|
||||||
|
value: 0.5,
|
||||||
|
text: t("labels.fine"),
|
||||||
|
icon: StrokeWidthFineIcon,
|
||||||
|
testId: "strokeWidth-fine",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
value: STROKE_WIDTH.thin,
|
value: STROKE_WIDTH.thin,
|
||||||
text: t("labels.thin"),
|
text: t("labels.thin"),
|
||||||
|
|
|
@ -2236,3 +2236,16 @@ export const elementLinkIcon = createIcon(
|
||||||
</g>,
|
</g>,
|
||||||
tablerIconProps,
|
tablerIconProps,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const StrokeWidthFineIcon = createIcon(
|
||||||
|
<>
|
||||||
|
<path
|
||||||
|
d="M4.167 10h11.666"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="0.75"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
/>
|
||||||
|
</>,
|
||||||
|
modifiedTablerIconProps,
|
||||||
|
);
|
||||||
|
|
|
@ -70,10 +70,11 @@
|
||||||
"crossHatch": "Cross-hatch",
|
"crossHatch": "Cross-hatch",
|
||||||
"thin": "Thin",
|
"thin": "Thin",
|
||||||
"bold": "Bold",
|
"bold": "Bold",
|
||||||
|
"extraBold": "Extra bold",
|
||||||
|
"fine": "Fine",
|
||||||
"left": "Left",
|
"left": "Left",
|
||||||
"center": "Center",
|
"center": "Center",
|
||||||
"right": "Right",
|
"right": "Right",
|
||||||
"extraBold": "Extra bold",
|
|
||||||
"architect": "Architect",
|
"architect": "Architect",
|
||||||
"artist": "Artist",
|
"artist": "Artist",
|
||||||
"cartoonist": "Cartoonist",
|
"cartoonist": "Cartoonist",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue