|
|
|
@ -5,7 +5,7 @@ import { PaintMode } from './paintModel';
|
|
|
|
|
import * as PIXI from 'pixi.js'; |
|
|
|
|
import { PropertyInfo } from './PropertyInfo'; |
|
|
|
|
import { AxShape } from './axShape'; |
|
|
|
|
import { Sprite } from 'pixi.js'; |
|
|
|
|
import { Sprite, Point } from 'pixi.js'; |
|
|
|
|
import { AxArrowConnector } from './axArrowConnector'; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -72,11 +72,33 @@ export class AxImageShape extends AxShape {
|
|
|
|
|
this.addChild(this.selectionBox); |
|
|
|
|
|
|
|
|
|
////
|
|
|
|
|
var leftUpPos = new Point(0, 0); |
|
|
|
|
var upLeftDrag = false; |
|
|
|
|
var leftDownPos = new Point(0, 0); |
|
|
|
|
var rightUpPos = new Point(0, 0); |
|
|
|
|
var rightDownPos = new Point(0, 0); |
|
|
|
|
// up-left
|
|
|
|
|
this.upLeft = new PIXI.Sprite(this.pointTexture); |
|
|
|
|
this.upLeft.anchor.set(0.5); |
|
|
|
|
this.addChild(this.upLeft); |
|
|
|
|
this.upLeft.interactive = true; |
|
|
|
|
this.upLeft.on('pointerdown', event => { |
|
|
|
|
event.stopPropagation(); |
|
|
|
|
upLeftDrag = true; |
|
|
|
|
// this.pivot.set(1);
|
|
|
|
|
var imageRect = this.image.getLocalBounds(); |
|
|
|
|
rightDownPos = new Point(imageRect.right, imageRect.bottom); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
this.upLeft.on('pointermove', event => { |
|
|
|
|
// 移动时调整形状大小,然后重绘边框
|
|
|
|
|
// 检查右下角距离鼠标的位置,
|
|
|
|
|
event.stopPropagation(); |
|
|
|
|
leftUpPos = this.toLocal(event.data.global); |
|
|
|
|
this.image.width = Math.abs(leftUpPos.x - rightDownPos.x); |
|
|
|
|
this.image.height = Math.abs(leftUpPos.y - rightDownPos.y); |
|
|
|
|
}); |
|
|
|
|
this.upLeft.visible = false; |
|
|
|
|
// up-right
|
|
|
|
|
this.upRight = new PIXI.Sprite(this.pointTexture); |
|
|
|
|