路径处理

This commit is contained in:
Yuan 2023-12-13 16:01:53 +08:00
parent f7347ebb44
commit c18057649b
7 changed files with 15 additions and 157 deletions

View File

@ -1,14 +1,14 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
declare namespace GlobalMixins {
type JlCanvasType = import('./app').IJlCanvas;
type CanvasProperties = import('./app').ICanvasProperties;
type GraphicApp = import('./app').IGraphicApp;
type JlGraphicType = import('./core').JlGraphic;
type GraphicData = import('./core').GraphicData;
type GraphicState = import('./core').GraphicState;
type GraphicTransform = import('./core').GraphicTransform;
type GraphicTransformEvent = import('./plugins').GraphicTransformEvent;
type BoundsGraphic = import('./plugins').BoundsGraphic;
type JlCanvasType = import('./src/app').IJlCanvas;
type CanvasProperties = import('./src/app').ICanvasProperties;
type GraphicApp = import('./src/app').IGraphicApp;
type JlGraphicType = import('./src/core').JlGraphic;
type GraphicData = import('./src/core').GraphicData;
type GraphicState = import('./src/core').GraphicState;
type GraphicTransform = import('./src/core').GraphicTransform;
type GraphicTransformEvent = import('./src/plugins').GraphicTransformEvent;
type BoundsGraphic = import('./src/plugins').BoundsGraphic;
type IPointDataType = import('pixi.js').IPointData;
type PointType = import('pixi.js').Point;
type FederatedMouseEvent = import('pixi.js').FederatedMouseEvent;

143
lib/global.d.ts vendored
View File

@ -1,143 +0,0 @@
declare namespace GlobalMixins {
type JlCanvasType = import('./app').IJlCanvas;
type CanvasProperties = import('./app').ICanvasProperties;
type GraphicApp = import('./app').IGraphicApp;
type JlGraphicType = import('./core').JlGraphic;
type GraphicData = import('./core').GraphicData;
type GraphicState = import('./core').GraphicState;
type GraphicTransform = import('./core').GraphicTransform;
type GraphicTransformEvent = import('./plugins').GraphicTransformEvent;
type BoundsGraphic = import('./plugins').BoundsGraphic;
type IPointDataType = import('pixi.js').IPointData;
type PointType = import('pixi.js').Point;
type FederatedMouseEvent = import('pixi.js').FederatedMouseEvent;
type DisplayObjectType = import('pixi.js').DisplayObject;
type ContainerType = import('pixi.js').Container;
interface DisplayObjectEvents {
'enter-absorbable-area': [number | undefined, number | undefined];
'out-absorbable-area': [number | undefined, number | undefined];
dataupdate: [newVal: any, oldVal: any];
stateupdate: [newVal: any, oldVal: any];
repaint: [DisplayObjectType];
transformstart: [e: GraphicTransformEvent];
transforming: [e: GraphicTransformEvent];
transformend: [e: GraphicTransformEvent];
_rightclick: [e: FederatedMouseEvent];
_leftclick: [e: FederatedMouseEvent];
selected: [DisplayObjectType];
unselected: [DisplayObjectType];
childselected: [DisplayObjectType];
childunselected: [DisplayObjectType];
}
interface GraphicAppEvents {
}
interface DisplayObject {
_selectable: boolean;
_selected: boolean;
selectable: boolean;
selected: boolean;
_childEdit: boolean;
childEdit: boolean;
_transformSave: boolean;
transformSave: boolean;
_assistantAppendMap: Map<string, DisplayObjectType> | null;
assistantAppendMap: Map<string, DisplayObjectType>;
_draggable: boolean;
draggable: boolean;
_shiftStartPoint: PointType | null;
shiftStartPoint: PointType | null;
_shiftLastPoint: PointType | null;
shiftLastPoint: PointType | null;
_scalable: boolean;
scalable: boolean;
_keepAspectRatio: boolean;
keepAspectRatio: boolean;
_rotatable: boolean;
rotatable: boolean;
worldAngle: number;
/**
*
*/
getAllParentScaled(): PointType;
/**
*
*/
getPositionOnCanvas(): PointType;
/**
*
* @param p
*/
updatePositionByCanvasPosition(p: IPointData): void;
/**
*
*/
saveTransform(): GraphicTransform;
/**
*
* @param transform
*/
loadTransform(transform: GraphicTransform): void;
isChild(obj: DisplayObject): boolean;
isParent(obj: DisplayObject): boolean;
isAssistantAppend(): boolean;
addAssistantAppend<D extends DisplayObjectType>(...appends: D[]): void;
removeAssistantAppend(...appends: DisplayObjectType[]): void;
removeAssistantAppendByName(...names: string[]): void;
removeAllAssistantAppend(): void;
getAssistantAppend<D extends DisplayObjectType>(name: string): D | undefined;
isGraphic(): boolean;
getGraphic<G extends JlGraphicType>(): G | null;
isGraphicChild(): boolean;
onAddToCanvas(canvas: JlCanvasType): void;
onRemoveFromCanvas(canvas: JlCanvasType): void;
isInCanvas(): boolean;
getCanvas(): JlCanvasType;
isCanvas(): boolean;
getViewport(): Viewport;
getGraphicApp(): GraphicApp;
/**
*
* @param p
*/
localToCanvasPoint(p: IPointData): PointType;
/**
*
* @param points
*/
localToCanvasPoints(...points: IPointData[]): PointType[];
/**
*
* @param p
*/
canvasToLocalPoint(p: IPointData): PointType;
/**
*
* @param points
*/
canvasToLocalPoints(...points: IPointData[]): PointType[];
/**
*
* @param p
*/
localToScreenPoint(p: IPointData): PointType;
/**
*
* @param points
*/
localToScreenPoints(...points: IPointData[]): PointType[];
/**
*
* @param p
*/
screenToLocalPoint(p: IPointData): PointType;
/**
*
* @param points
*/
screenToLocalPoints(...points: IPointData[]): PointType[];
localBoundsToCanvasPoints(): PointType[];
}
interface Graphics {
drawBezierCurve(p1: IPointData, p2: IPointData, cp1: IPointData, cp2: IPointData, segmentsCount: number): Graphics;
}
}

1
lib/index.d.ts vendored
View File

@ -1,4 +1,3 @@
/// <reference types="lib/global" />
export * as GraphicsExtras from '@pixi/graphics-extras';
export * from './app';
export * from './core';

View File

@ -11,6 +11,10 @@
"scripts": {
"build": "rollup -c rollup.config.ts --configPlugin typescript"
},
"files": [
"lib",
"*.d.ts"
],
"dependencies": {
"@pixi/graphics-extras": "^7.3.2",
"@pixi/utils": "^7.3.2",

View File

@ -22,7 +22,7 @@ const config: RollupOptions = {
typescript({
declaration: true,
declarationDir: 'lib',
include: ['src/**/*'],
include: ['src/**/*', "global.d.ts"],
tsconfig: './tsconfig.json',
}),
],

View File

@ -1,6 +1,4 @@
/// <reference path="./global.ts" />
export * as GraphicsExtras from '@pixi/graphics-extras';
export * from './app';
export * from './core';
export * from './graphic';

View File

@ -13,6 +13,6 @@
"lib": ["esnext", "dom"],
"useDefineForClassFields": true
},
"include": ["src/**/*.ts", "rollup.config.ts"],
"include": ["src/**/*.ts", "rollup.config.ts", "global.d.ts"],
"exclude": ["node_modules"]
}