Commit 46231478 authored by rockyl's avatar rockyl

修复

parent baa93b2f
...@@ -11,6 +11,13 @@ import {Point} from "../../2d/math/Point"; ...@@ -11,6 +11,13 @@ import {Point} from "../../2d/math/Point";
const propPrefixFilter = ['_', '__', '$']; const propPrefixFilter = ['_', '__', '$'];
const propTypeFilter = ['function']; const propTypeFilter = ['function'];
const offsetPrefix = 'offset_';
const absValueMapping = {
x: 'a',
y: 'd',
width: 'a',
height: 'b',
};
/** /**
* 编辑器舞台 * 编辑器舞台
...@@ -75,7 +82,17 @@ export class EditorStage extends Node { ...@@ -75,7 +82,17 @@ export class EditorStage extends Node {
let node = this.getNode(nodePath, true); let node = this.getNode(nodePath, true);
if (node) { if (node) {
injectProperties(node, props); for (let key in props) {
let v = props[key];
if (key.indexOf(offsetPrefix) < 0) {
node[key] = v;
} else {
key = key.replace(offsetPrefix, '');
let offsetV = v / node.worldMatrix[absValueMapping[key]];
node[key] += offsetV;
console.log('modifyProps:', key, offsetV, node[key]);
}
}
node.adjustProxy.adjustLayout(); node.adjustProxy.adjustLayout();
return true; return true;
} else { } else {
...@@ -85,6 +102,7 @@ export class EditorStage extends Node { ...@@ -85,6 +102,7 @@ export class EditorStage extends Node {
} }
private _pos = new Point(); private _pos = new Point();
getNodeWithPos(pos) { getNodeWithPos(pos) {
let globalPos: any = this.stage.globalToLocal(pos, this._pos); let globalPos: any = this.stage.globalToLocal(pos, this._pos);
globalPos.x *= devicePixelRatio; globalPos.x *= devicePixelRatio;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment