mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-22 08:50:56 +02:00
fix: hiding arrow
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
|||||||
} from "@excalidraw/common";
|
} from "@excalidraw/common";
|
||||||
|
|
||||||
import { RoughGenerator } from "roughjs/bin/generator";
|
import { RoughGenerator } from "roughjs/bin/generator";
|
||||||
|
import chroma from "chroma-js";
|
||||||
|
|
||||||
import type { GlobalPoint } from "@excalidraw/math";
|
import type { GlobalPoint } from "@excalidraw/math";
|
||||||
|
|
||||||
@@ -70,6 +71,7 @@ import type {
|
|||||||
ExcalidrawFreeDrawElement,
|
ExcalidrawFreeDrawElement,
|
||||||
ElementsMap,
|
ElementsMap,
|
||||||
ExcalidrawLineElement,
|
ExcalidrawLineElement,
|
||||||
|
ExcalidrawBindableElement,
|
||||||
} from "./types";
|
} from "./types";
|
||||||
|
|
||||||
import type { Drawable, Options } from "roughjs/bin/core";
|
import type { Drawable, Options } from "roughjs/bin/core";
|
||||||
@@ -105,6 +107,33 @@ export class ShapeCache {
|
|||||||
ShapeCache.cache = new WeakMap();
|
ShapeCache.cache = new WeakMap();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static generateBindableElementHighlight = <
|
||||||
|
T extends ExcalidrawBindableElement,
|
||||||
|
>(
|
||||||
|
element: T,
|
||||||
|
renderConfig?: {
|
||||||
|
isExporting: boolean;
|
||||||
|
canvasBackgroundColor: AppState["viewBackgroundColor"];
|
||||||
|
embedsValidationStatus: EmbedsValidationStatus;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const shape = generateElementShape(
|
||||||
|
element,
|
||||||
|
ShapeCache.rg,
|
||||||
|
renderConfig || {
|
||||||
|
isExporting: false,
|
||||||
|
canvasBackgroundColor: COLOR_PALETTE.white,
|
||||||
|
embedsValidationStatus: null,
|
||||||
|
},
|
||||||
|
) as Drawable;
|
||||||
|
|
||||||
|
shape.options.fill = "transparent";
|
||||||
|
shape.options.stroke = chroma(shape.options.stroke).desaturate().hex();
|
||||||
|
shape.options.strokeWidth = shape.options.strokeWidth * 1.1;
|
||||||
|
|
||||||
|
return shape;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates & caches shape for element if not already cached, otherwise
|
* Generates & caches shape for element if not already cached, otherwise
|
||||||
* returns cached shape.
|
* returns cached shape.
|
||||||
|
@@ -44,7 +44,6 @@ import {
|
|||||||
} from "@excalidraw/element";
|
} from "@excalidraw/element";
|
||||||
|
|
||||||
import { getCommonBounds, getElementAbsoluteCoords } from "@excalidraw/element";
|
import { getCommonBounds, getElementAbsoluteCoords } from "@excalidraw/element";
|
||||||
import chroma from "chroma-js";
|
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
SuggestedBinding,
|
SuggestedBinding,
|
||||||
@@ -194,15 +193,8 @@ const renderBindingHighlightForBindableElement = (
|
|||||||
context.translate(element.x, element.y);
|
context.translate(element.x, element.y);
|
||||||
|
|
||||||
const rc = rough.canvas(context.canvas);
|
const rc = rough.canvas(context.canvas);
|
||||||
const drawable = ShapeCache.get(element)!;
|
const drawable = ShapeCache.generateBindableElementHighlight(element);
|
||||||
const originalColor = drawable.options.stroke;
|
|
||||||
const originalStrokeWidth = drawable.options.strokeWidth;
|
|
||||||
|
|
||||||
drawable.options.stroke = chroma(drawable.options.stroke).desaturate().hex();
|
|
||||||
drawable.options.strokeWidth = drawable.options.strokeWidth * 1.1;
|
|
||||||
rc.draw(drawable);
|
rc.draw(drawable);
|
||||||
drawable.options.stroke = originalColor;
|
|
||||||
drawable.options.strokeWidth = originalStrokeWidth;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderBindingHighlightForSuggestedPointBinding = (
|
const renderBindingHighlightForSuggestedPointBinding = (
|
||||||
|
Reference in New Issue
Block a user