mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 10:22:55 +08:00
refactor(editor): add gfx entry in bs global package (#10612)
This commit is contained in:
@@ -26,7 +26,7 @@ import {
|
||||
type SerializedXYWH,
|
||||
transformPointsToNewBound,
|
||||
Vec,
|
||||
} from '@blocksuite/global/utils';
|
||||
} from '@blocksuite/global/gfx';
|
||||
|
||||
import { type Color, DefaultTheme } from '../../themes/index';
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
GfxPrimitiveElementModel,
|
||||
local,
|
||||
} from '@blocksuite/block-std/gfx';
|
||||
import type { IVec, SerializedXYWH, XYWH } from '@blocksuite/global/utils';
|
||||
import type { IVec, SerializedXYWH, XYWH } from '@blocksuite/global/gfx';
|
||||
import {
|
||||
Bound,
|
||||
curveIntersects,
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
Polyline,
|
||||
polyLineNearestPoint,
|
||||
Vec,
|
||||
} from '@blocksuite/global/utils';
|
||||
} from '@blocksuite/global/gfx';
|
||||
import * as Y from 'yjs';
|
||||
|
||||
import {
|
||||
@@ -293,6 +293,10 @@ export class ConnectorElementModel extends GfxPrimitiveElementModel<ConnectorEle
|
||||
? getBezierNearestPoint(getBezierParameters(path), currentPoint)
|
||||
: polyLineNearestPoint(path, currentPoint);
|
||||
|
||||
if (!point) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
Vec.dist(point, currentPoint) <
|
||||
(options?.hitThreshold ? strokeWidth / 2 : 0) + 8
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GfxLocalElementModel } from '@blocksuite/block-std/gfx';
|
||||
import type { PointLocation } from '@blocksuite/global/utils';
|
||||
import type { PointLocation } from '@blocksuite/global/gfx';
|
||||
|
||||
import {
|
||||
ConnectorMode,
|
||||
|
||||
@@ -10,8 +10,9 @@ import {
|
||||
local,
|
||||
observe,
|
||||
} from '@blocksuite/block-std/gfx';
|
||||
import type { IVec, PointLocation } from '@blocksuite/global/utils';
|
||||
import { Bound, keys, linePolygonIntersects } from '@blocksuite/global/utils';
|
||||
import type { IVec, PointLocation } from '@blocksuite/global/gfx';
|
||||
import { Bound, linePolygonIntersects } from '@blocksuite/global/gfx';
|
||||
import { keys } from '@blocksuite/global/utils';
|
||||
import * as Y from 'yjs';
|
||||
|
||||
type GroupElementProps = BaseElementProps & {
|
||||
|
||||
@@ -12,15 +12,9 @@ import {
|
||||
observe,
|
||||
watch,
|
||||
} from '@blocksuite/block-std/gfx';
|
||||
import type { Bound, SerializedXYWH, XYWH } from '@blocksuite/global/utils';
|
||||
import {
|
||||
assertType,
|
||||
deserializeXYWH,
|
||||
keys,
|
||||
last,
|
||||
noop,
|
||||
pick,
|
||||
} from '@blocksuite/global/utils';
|
||||
import type { Bound, SerializedXYWH, XYWH } from '@blocksuite/global/gfx';
|
||||
import { deserializeXYWH } from '@blocksuite/global/gfx';
|
||||
import { assertType, keys, last, noop, pick } from '@blocksuite/global/utils';
|
||||
import { generateKeyBetween } from 'fractional-indexing';
|
||||
import * as Y from 'yjs';
|
||||
import { z } from 'zod';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { PointTestOptions } from '@blocksuite/block-std/gfx';
|
||||
import type { IBound, IVec } from '@blocksuite/global/utils';
|
||||
import type { IBound, IVec } from '@blocksuite/global/gfx';
|
||||
import {
|
||||
Bound,
|
||||
getCenterAreaBounds,
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
polygonGetPointTangent,
|
||||
polygonNearestPoint,
|
||||
rotatePoints,
|
||||
} from '@blocksuite/global/utils';
|
||||
} from '@blocksuite/global/gfx';
|
||||
|
||||
import { DEFAULT_CENTRAL_AREA_RATIO } from '../../../consts/index.js';
|
||||
import type { ShapeElementModel } from '../shape.js';
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
rotatePoints,
|
||||
toRadian,
|
||||
Vec,
|
||||
} from '@blocksuite/global/utils';
|
||||
} from '@blocksuite/global/gfx';
|
||||
|
||||
import { DEFAULT_CENTRAL_AREA_RATIO } from '../../../consts/index.js';
|
||||
import type { ShapeElementModel } from '../shape.js';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { PointTestOptions } from '@blocksuite/block-std/gfx';
|
||||
import type { IBound, IVec } from '@blocksuite/global/utils';
|
||||
import type { IBound, IVec } from '@blocksuite/global/gfx';
|
||||
import {
|
||||
Bound,
|
||||
getCenterAreaBounds,
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
polygonGetPointTangent,
|
||||
polygonNearestPoint,
|
||||
rotatePoints,
|
||||
} from '@blocksuite/global/utils';
|
||||
} from '@blocksuite/global/gfx';
|
||||
|
||||
import { DEFAULT_CENTRAL_AREA_RATIO } from '../../../consts/index.js';
|
||||
import type { ShapeElementModel } from '../shape.js';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { PointTestOptions } from '@blocksuite/block-std/gfx';
|
||||
import type { IBound, IVec } from '@blocksuite/global/utils';
|
||||
import type { IBound, IVec } from '@blocksuite/global/gfx';
|
||||
import {
|
||||
Bound,
|
||||
getCenterAreaBounds,
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
polygonGetPointTangent,
|
||||
polygonNearestPoint,
|
||||
rotatePoints,
|
||||
} from '@blocksuite/global/utils';
|
||||
} from '@blocksuite/global/gfx';
|
||||
|
||||
import { DEFAULT_CENTRAL_AREA_RATIO } from '../../../consts/index.js';
|
||||
import type { ShapeElementModel } from '../shape.js';
|
||||
|
||||
@@ -15,7 +15,7 @@ import type {
|
||||
IVec,
|
||||
PointLocation,
|
||||
SerializedXYWH,
|
||||
} from '@blocksuite/global/utils';
|
||||
} from '@blocksuite/global/gfx';
|
||||
import * as Y from 'yjs';
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { BaseElementProps } from '@blocksuite/block-std/gfx';
|
||||
import { field, GfxPrimitiveElementModel } from '@blocksuite/block-std/gfx';
|
||||
import type { IVec, SerializedXYWH } from '@blocksuite/global/utils';
|
||||
import type { IVec, SerializedXYWH } from '@blocksuite/global/gfx';
|
||||
import {
|
||||
Bound,
|
||||
getPointsFromBoundWithRotation,
|
||||
linePolygonIntersects,
|
||||
pointInPolygon,
|
||||
polygonNearestPoint,
|
||||
} from '@blocksuite/global/utils';
|
||||
} from '@blocksuite/global/gfx';
|
||||
import * as Y from 'yjs';
|
||||
|
||||
import {
|
||||
|
||||
Reference in New Issue
Block a user