fix(editor): 水平居中

This commit is contained in:
roymondchen 2022-07-26 13:24:56 +08:00 committed by jia000
parent 940b08b2c5
commit dd1ec53064

View File

@ -539,8 +539,8 @@ class Editor extends BaseService {
const doc = stage?.renderer.contentWindow?.document;
if (doc) {
const parentEl = doc.getElementById(`${parent.id}`);
const el = doc.getElementById(`${node.id}`);
const parentEl = el?.offsetParent;
if (parentEl && el) {
node.style.left = (parentEl.clientWidth - el.clientWidth) / 2;
}