fix: edge handlers use style.edgeStyle (#78)

Use the `edgeStyle` property of `CellStateStyles` in `ElbowEdgeHandler` and `EdgeHandler`.
development
CD Yang 2022-02-21 00:44:37 +08:00 committed by GitHub
parent aa22e83c15
commit 7fa2b433c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -220,7 +220,7 @@ export type GradientMap = {
};
export interface GraphPluginConstructor {
new (graph: Graph): GraphPlugin;
new(graph: Graph): GraphPlugin;
pluginId: string;
}

View File

@ -415,8 +415,8 @@ class EdgeHandler {
isVirtualBendsEnabled(evt?: Event) {
return (
this.virtualBendsEnabled &&
(this.state.style.edge == null ||
this.state.style.edge === NONE ||
(this.state.style.edgeStyle == null ||
this.state.style.edgeStyle === NONE ||
this.state.style.noEdgeStyle) &&
this.state.style.shape !== 'arrow'
);
@ -958,12 +958,12 @@ class EdgeHandler {
* Hook for subclassers do show details while the handler is active.
*/
updateHint(me: InternalMouseEvent, point: Point) {}
updateHint(me: InternalMouseEvent, point: Point) { }
/**
* Hooks for subclassers to hide details when the handler gets inactive.
*/
removeHint() {}
removeHint() { }
/**
* Hook for rounding the unscaled width or height. This uses Math.round.

View File

@ -107,8 +107,8 @@ class ElbowEdgeHandler extends EdgeHandler {
* Returns the cursor to be used for the bend.
*/
getCursorForBend() {
return this.state.style.edge === EDGESTYLE.TOPTOBOTTOM ||
(this.state.style.edge === EDGESTYLE.ELBOW &&
return this.state.style.edgeStyle === EDGESTYLE.TOPTOBOTTOM ||
(this.state.style.edgeStyle === EDGESTYLE.ELBOW &&
this.state.style.elbow === ELBOW.VERTICAL)
? 'row-resize'
: 'col-resize';
@ -179,9 +179,9 @@ class ElbowEdgeHandler extends EdgeHandler {
} else {
pt = new Point(
this.graph.getView().scale *
(pt.x + this.graph.getView().translate.x + this.state.origin.x),
(pt.x + this.graph.getView().translate.x + this.state.origin.x),
this.graph.getView().scale *
(pt.y + this.graph.getView().translate.y + this.state.origin.y)
(pt.y + this.graph.getView().translate.y + this.state.origin.y)
);
}