将CREATE_BEFORE的传入参数统一为model而非modelDefine

This commit is contained in:
猴赛雷 2024-11-13 14:37:14 +08:00
parent 949389538a
commit 9ace402379
3 changed files with 17 additions and 18 deletions

View File

@ -1,6 +1,6 @@
{
"name": "ddei-editor",
"version": "1.2.43-4",
"version": "1.2.43-6",
"private": false,
"type": "module",
"author": "hoslay <3697355039@qq.com>",

View File

@ -238,7 +238,6 @@ export default {
*/
createControlPrepare(group, e) {
let control = group.currentControl ? group.currentControl : group.controls?.length > 0 ? group.controls[0] : null
let editMode = group.editMode
//
@ -458,23 +457,23 @@ export default {
if ((layer.display == 0 && !layer.tempDisplay) || layer.lock) {
return;
}
let rsState = DDeiUtil.invokeCallbackFunc("EVENT_CONTROL_CREATE_BEFORE", DDeiEnumOperateType.CREATE, { models: [control] }, ddInstance, e)
if (rsState == 0 || rsState == 1) {
let controlInitJSON = DDeiEditorUtil.getModelInitJSON(this.editor.ddInstance, null, [{ model: control.id }])
let controlInitJSON = DDeiEditorUtil.getModelInitJSON(this.editor.ddInstance, null, [{ model: control.id }])
if (controlInitJSON){
let models = this.editor.addControls(controlInitJSON)
let pushDatas = []
models.forEach((model, key) => {
pushDatas.push({ id: model.id, value: DDeiEnumControlState.SELECTED });
});
this.editor.ddInstance?.bus?.push(DDeiEnumBusCommandType.CancelCurLevelSelectedModels, null, e);
this.editor.ddInstance?.bus?.push(DDeiEnumBusCommandType.ModelChangeSelect, pushDatas, e);
this.editor.ddInstance?.bus?.push(DDeiEnumBusCommandType.StageChangeSelectModels);
this.editor.bus.executeAll()
this.editor.changeState(DDeiEditorState.DESIGNING);
DDeiUtil.invokeCallbackFunc("EVENT_CONTROL_CREATE_AFTER", DDeiEnumOperateType.CREATE, { models: models }, ddInstance, e)
}
let rsState = DDeiUtil.invokeCallbackFunc("EVENT_CONTROL_CREATE_BEFORE", DDeiEnumOperateType.CREATE, { models: models }, ddInstance, e)
if (rsState == 0 || rsState == 1) {
let pushDatas = []
models.forEach((model, key) => {
pushDatas.push({ id: model.id, value: DDeiEnumControlState.SELECTED });
});
this.editor.ddInstance?.bus?.push(DDeiEnumBusCommandType.CancelCurLevelSelectedModels, null, e);
this.editor.ddInstance?.bus?.push(DDeiEnumBusCommandType.ModelChangeSelect, pushDatas, e);
this.editor.ddInstance?.bus?.push(DDeiEnumBusCommandType.StageChangeSelectModels);
this.editor.bus.executeAll()
this.editor.changeState(DDeiEditorState.DESIGNING);
DDeiUtil.invokeCallbackFunc("EVENT_CONTROL_CREATE_AFTER", DDeiEnumOperateType.CREATE, { models: models }, ddInstance, e)
}
}
}
}

View File

@ -21,7 +21,7 @@ export default defineComponent({
data() {
const options = markRaw({
// currentLayout: "ddei-core-layout-simple",
currentLayout: "ddei-core-layout-simple",
config: {
ratio: 1.2, //120%
pixel:2, //