|
@@ -37,76 +37,77 @@ import {
|
|
} from "@persagy-web/graph";
|
|
} from "@persagy-web/graph";
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 直线item
|
|
|
|
|
|
+ * 折线item
|
|
*
|
|
*
|
|
|
|
+ * @author 郝建龙
|
|
* */
|
|
* */
|
|
|
|
|
|
export class SPolylineItem extends SGraphItem {
|
|
export class SPolylineItem extends SGraphItem {
|
|
- /** X坐标最小值 */
|
|
|
|
|
|
+ /** X坐标最小值 */
|
|
private minX = Number.MAX_SAFE_INTEGER;
|
|
private minX = Number.MAX_SAFE_INTEGER;
|
|
- /** X坐标最大值 */
|
|
|
|
|
|
+ /** X坐标最大值 */
|
|
private maxX = Number.MIN_SAFE_INTEGER;
|
|
private maxX = Number.MIN_SAFE_INTEGER;
|
|
- /** Y坐标最小值 */
|
|
|
|
|
|
+ /** Y坐标最小值 */
|
|
private minY = Number.MAX_SAFE_INTEGER;
|
|
private minY = Number.MAX_SAFE_INTEGER;
|
|
- /** Y坐标最大值 */
|
|
|
|
|
|
+ /** Y坐标最大值 */
|
|
private maxY = Number.MIN_SAFE_INTEGER;
|
|
private maxY = Number.MIN_SAFE_INTEGER;
|
|
- /** 折点信息 */
|
|
|
|
|
|
+ /** 折点信息 */
|
|
pointList: SPoint[] = [];
|
|
pointList: SPoint[] = [];
|
|
- /** 是否绘制完成 */
|
|
|
|
|
|
+ /** 是否绘制完成 */
|
|
_status: SItemStatus = SItemStatus.Normal;
|
|
_status: SItemStatus = SItemStatus.Normal;
|
|
get status(): SItemStatus {
|
|
get status(): SItemStatus {
|
|
return this._status;
|
|
return this._status;
|
|
- }
|
|
|
|
|
|
+ } // Get status
|
|
set status(v: SItemStatus) {
|
|
set status(v: SItemStatus) {
|
|
this._status = v;
|
|
this._status = v;
|
|
this.undoStack.clear();
|
|
this.undoStack.clear();
|
|
this.update();
|
|
this.update();
|
|
- }
|
|
|
|
|
|
+ } // Set status
|
|
/** 鼠标移动时的点 */
|
|
/** 鼠标移动时的点 */
|
|
private lastPoint: SPoint | null = null;
|
|
private lastPoint: SPoint | null = null;
|
|
- /** 线条颜色 */
|
|
|
|
|
|
+ /** 线条颜色 */
|
|
_strokeColor: SColor = SColor.Black;
|
|
_strokeColor: SColor = SColor.Black;
|
|
get strokeColor(): SColor {
|
|
get strokeColor(): SColor {
|
|
return this._strokeColor;
|
|
return this._strokeColor;
|
|
- }
|
|
|
|
|
|
+ } // Get strokeColor
|
|
set strokeColor(v: SColor) {
|
|
set strokeColor(v: SColor) {
|
|
this._strokeColor = v;
|
|
this._strokeColor = v;
|
|
this.update();
|
|
this.update();
|
|
- }
|
|
|
|
|
|
+ } // Set strokeColor
|
|
/** 填充色 */
|
|
/** 填充色 */
|
|
_fillColor: SColor = new SColor("#2196f3");
|
|
_fillColor: SColor = new SColor("#2196f3");
|
|
get fillColor(): SColor {
|
|
get fillColor(): SColor {
|
|
return this._fillColor;
|
|
return this._fillColor;
|
|
- }
|
|
|
|
|
|
+ } // Get fillColor
|
|
set fillColor(v: SColor) {
|
|
set fillColor(v: SColor) {
|
|
this._fillColor = v;
|
|
this._fillColor = v;
|
|
this.update();
|
|
this.update();
|
|
- }
|
|
|
|
- /** 线条宽度 */
|
|
|
|
|
|
+ } // Set fillColor
|
|
|
|
+ /** 线条宽度 */
|
|
_lineWidth: number = 1;
|
|
_lineWidth: number = 1;
|
|
get lineWidth(): number {
|
|
get lineWidth(): number {
|
|
return this._lineWidth;
|
|
return this._lineWidth;
|
|
- }
|
|
|
|
|
|
+ } // Get lineWidth
|
|
set lineWidth(v: number) {
|
|
set lineWidth(v: number) {
|
|
this._lineWidth = v;
|
|
this._lineWidth = v;
|
|
this.update();
|
|
this.update();
|
|
- }
|
|
|
|
|
|
+ } // Set lineWidth
|
|
/** 边框样式 */
|
|
/** 边框样式 */
|
|
_lineStyle: SLineStyle = SLineStyle.Solid;
|
|
_lineStyle: SLineStyle = SLineStyle.Solid;
|
|
get lineStyle(): SLineStyle {
|
|
get lineStyle(): SLineStyle {
|
|
return this._lineStyle;
|
|
return this._lineStyle;
|
|
- }
|
|
|
|
|
|
+ } // Get lineStyle
|
|
set lineStyle(v: SLineStyle) {
|
|
set lineStyle(v: SLineStyle) {
|
|
this._lineStyle = v;
|
|
this._lineStyle = v;
|
|
this.update();
|
|
this.update();
|
|
- }
|
|
|
|
- /** 全局灵敏度 */
|
|
|
|
|
|
+ } // Set lineStyle
|
|
|
|
+ /** 全局灵敏度 */
|
|
dis: number = 10;
|
|
dis: number = 10;
|
|
- /** 灵敏度转换为场景长度 */
|
|
|
|
|
|
+ /** 灵敏度转换为场景长度 */
|
|
private sceneDis: number = 10;
|
|
private sceneDis: number = 10;
|
|
- /** 当前点索引 */
|
|
|
|
|
|
+ /** 当前点索引 */
|
|
private curIndex: number = -1;
|
|
private curIndex: number = -1;
|
|
- /** 当前点索引 */
|
|
|
|
|
|
+ /** 当前点 */
|
|
private curPoint: SPoint | null = null;
|
|
private curPoint: SPoint | null = null;
|
|
/** undo/redo堆栈 */
|
|
/** undo/redo堆栈 */
|
|
private undoStack: SUndoStack = new SUndoStack();
|
|
private undoStack: SUndoStack = new SUndoStack();
|
|
@@ -416,6 +417,7 @@ export class SPolylineItem extends SGraphItem {
|
|
* shift垂直水平创建或编辑
|
|
* shift垂直水平创建或编辑
|
|
*
|
|
*
|
|
* @param event 事件
|
|
* @param event 事件
|
|
|
|
+ * @return 事件对象
|
|
* */
|
|
* */
|
|
compare(event: SMouseEvent): SMouseEvent {
|
|
compare(event: SMouseEvent): SMouseEvent {
|
|
if (this.pointList.length) {
|
|
if (this.pointList.length) {
|
|
@@ -548,6 +550,8 @@ export class SPolylineItem extends SGraphItem {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 绘制基本图形
|
|
* 绘制基本图形
|
|
|
|
+ *
|
|
|
|
+ * @param painter painter对象
|
|
* */
|
|
* */
|
|
drawBaseLine(painter: SPainter): void {
|
|
drawBaseLine(painter: SPainter): void {
|
|
// 绘制基本图形
|
|
// 绘制基本图形
|