Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/egret/exts/exml-exts/exml/common/exml/exmlModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2304,9 +2304,11 @@ export class ExmlModel implements IExmlModel {
value._readOnly = false;
}
let valueRange: number[] = xmlStrUtil.getValueIndex(nodeText, prop);
var oldValue = "";
if (valueRange) {
var startIndex: number = range[0] + valueRange[1];
var endIndex: number = range[0] + valueRange[2];
oldValue = this._text.substring(startIndex, endIndex);
this.pushTextChange(newValue, startIndex, endIndex);
} else if (!hostInMultiState) {
/*
Expand All @@ -2317,9 +2319,19 @@ export class ExmlModel implements IExmlModel {
if (valueRange) {
var startIndex: number = range[0] + valueRange[1];
var endIndex: number = range[0] + valueRange[2];
oldValue = this._text.substring(startIndex, endIndex);
this.pushTextChange(newValue, startIndex, endIndex);
}
}

// 控件id变更时要更新TweenItem的target
if (property == "id") {
if (oldValue) {
this._text = this._text.replace(new RegExp(`<tween:TweenItem target="\\{${oldValue}\\}">`, 'g'), function(substring, ...args) {
return `<tween:TweenItem target="{${newValue}}">`;
});
}
}
}

/**
Expand Down