mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 21:34:50 +08:00
make arrow with tension a bit better
This commit is contained in:
@@ -53,8 +53,8 @@ export class Arrow extends Line<ArrowConfig> {
|
||||
|
||||
var dx, dy;
|
||||
if (fromTension) {
|
||||
dx = points[n - 2] - tp[n - 2];
|
||||
dy = points[n - 1] - tp[n - 1];
|
||||
dx = points[n - 2] - (tp[tp.length - 2] + tp[tp.length - 4]) / 2;
|
||||
dy = points[n - 1] - (tp[tp.length - 1] + tp[tp.length - 3]) / 2;
|
||||
} else {
|
||||
dx = points[n - 2] - points[n - 4];
|
||||
dy = points[n - 1] - points[n - 3];
|
||||
@@ -78,8 +78,8 @@ export class Arrow extends Line<ArrowConfig> {
|
||||
ctx.save();
|
||||
ctx.translate(points[0], points[1]);
|
||||
if (fromTension) {
|
||||
dx = tp[0] - points[0];
|
||||
dy = tp[1] - points[1];
|
||||
dx = (tp[0] + tp[2]) / 2 - points[0];
|
||||
dy = (tp[1] + tp[3]) / 2 - points[1];
|
||||
} else {
|
||||
dx = points[2] - points[0];
|
||||
dy = points[3] - points[1];
|
||||
|
||||
@@ -5,6 +5,7 @@ import { getNumberValidator, getNumberArrayValidator } from '../Validators';
|
||||
import { _registerNode } from '../Global';
|
||||
|
||||
import { GetSet } from '../types';
|
||||
import { Context } from '../Context';
|
||||
|
||||
export interface LineConfig extends ShapeConfig {
|
||||
points: number[];
|
||||
@@ -50,7 +51,7 @@ export class Line<Config extends LineConfig = LineConfig> extends Shape<
|
||||
);
|
||||
}
|
||||
|
||||
_sceneFunc(context) {
|
||||
_sceneFunc(context: Context) {
|
||||
var points = this.points(),
|
||||
length = points.length,
|
||||
tension = this.tension(),
|
||||
|
||||
Reference in New Issue
Block a user