|
@@ -106,7 +106,14 @@ export class SGraphItem extends SObject {
|
|
} // Get inverseScale
|
|
} // Get inverseScale
|
|
|
|
|
|
/** 旋转角度 */
|
|
/** 旋转角度 */
|
|
- rolate: number = 0;
|
|
|
|
|
|
+ _rotate: number = 0;
|
|
|
|
+ get rotate(): number {
|
|
|
|
+ return this._rotate;
|
|
|
|
+ } // Get rotate
|
|
|
|
+ set rotate(v: number) {
|
|
|
|
+ this._rotate = v;
|
|
|
|
+ this.update();
|
|
|
|
+ } // Set rotate
|
|
|
|
|
|
/** 是否可见 */
|
|
/** 是否可见 */
|
|
private _visible: boolean = true;
|
|
private _visible: boolean = true;
|
|
@@ -192,7 +199,7 @@ export class SGraphItem extends SObject {
|
|
// item位移到指定位置绘制
|
|
// item位移到指定位置绘制
|
|
painter.translate(item.x, item.y);
|
|
painter.translate(item.x, item.y);
|
|
painter.scale(item.scale, item.scale);
|
|
painter.scale(item.scale, item.scale);
|
|
- painter.rotate(item.rolate);
|
|
|
|
|
|
+ painter.rotate(item.rotate);
|
|
|
|
|
|
// 如果不进行变形处理,则取消painter的变型操作
|
|
// 如果不进行变形处理,则取消painter的变型操作
|
|
if (!item.isTransform) {
|
|
if (!item.isTransform) {
|
|
@@ -336,7 +343,7 @@ export class SGraphItem extends SObject {
|
|
for (let item of list) {
|
|
for (let item of list) {
|
|
m.translate(item.x, item.y);
|
|
m.translate(item.x, item.y);
|
|
m.scale(item.scale, item.scale);
|
|
m.scale(item.scale, item.scale);
|
|
- m.rotate(item.rolate);
|
|
|
|
|
|
+ m.rotate(item.rotate);
|
|
|
|
|
|
// 如果不进行变形处理,则取消painter的变型操作
|
|
// 如果不进行变形处理,则取消painter的变型操作
|
|
if (!item.isTransform) {
|
|
if (!item.isTransform) {
|
|
@@ -624,9 +631,9 @@ export class SGraphItem extends SObject {
|
|
event: SMouseEvent
|
|
event: SMouseEvent
|
|
): SMouseEvent {
|
|
): SMouseEvent {
|
|
let ce = new SMouseEvent(event);
|
|
let ce = new SMouseEvent(event);
|
|
- // ce.matrix.rotate(0, 0, child.rolate);
|
|
|
|
ce.matrix.translate(child.x, child.y);
|
|
ce.matrix.translate(child.x, child.y);
|
|
ce.matrix.scale(child.scale, child.scale);
|
|
ce.matrix.scale(child.scale, child.scale);
|
|
|
|
+ ce.matrix.rotate(0, 0, child.rotate);
|
|
|
|
|
|
if (!child.isTransform) {
|
|
if (!child.isTransform) {
|
|
ce.matrix.scale(child._inverseScale, child._inverseScale);
|
|
ce.matrix.scale(child._inverseScale, child._inverseScale);
|
|
@@ -672,10 +679,10 @@ export class SGraphItem extends SObject {
|
|
private toParentChange(x: number, y: number): SPoint {
|
|
private toParentChange(x: number, y: number): SPoint {
|
|
const m = new SMatrix();
|
|
const m = new SMatrix();
|
|
m.scale(this.scale, this.scale);
|
|
m.scale(this.scale, this.scale);
|
|
- m.rotate(this.rolate);
|
|
|
|
if (!this.isTransform) {
|
|
if (!this.isTransform) {
|
|
m.scale(this._inverseScale, this._inverseScale);
|
|
m.scale(this._inverseScale, this._inverseScale);
|
|
}
|
|
}
|
|
|
|
+ m.rotate(this.rotate);
|
|
|
|
|
|
const mp = new SPoint(x, y).matrixTransform(m);
|
|
const mp = new SPoint(x, y).matrixTransform(m);
|
|
return new SPoint(mp.x, mp.y);
|
|
return new SPoint(mp.x, mp.y);
|