本文整理汇总了TypeScript中eez-studio-shared/store.commitTransaction函数的典型用法代码示例。如果您正苦于以下问题:TypeScript commitTransaction函数的具体用法?TypeScript commitTransaction怎么用?TypeScript commitTransaction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了commitTransaction函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: showAddInstrumentDialog
showAddInstrumentDialog(extension => {
beginTransaction("Add instrument");
let params = createInstrument(extension);
params.rect.left =
context.viewState.transform.centerPoint.x - params.rect.width / 2;
params.rect.top =
context.viewState.transform.centerPoint.y - params.rect.height / 2;
context.document.createObject(params);
commitTransaction();
});
示例2: deleteObjects
deleteObjects(objects: IBaseObject[]) {
if (objects.length > 0) {
beginTransaction("Delete workbench items");
} else {
beginTransaction("Delete workbench item");
}
objects.forEach(object => deleteWorkbenchObject(object as WorkbenchObject));
commitTransaction();
}
示例3: deleteGroup
export function deleteGroup(group: Partial<IGroup>) {
beginTransaction("Delete shortcuts group");
store.deleteObject(group);
values(shortcuts)
.filter(shortcut => shortcut.groupName === group.name)
.forEach(shortcut => shortcutsStore.deleteObject(shortcut));
commitTransaction();
}
示例4: onDragEnd
onDragEnd(op: "move" | "resize", changed: boolean, objects: IWorkbenchObject[]): void {
if (changed) {
if (objects.length > 0) {
beginTransaction(`${humanize(op)} workbench items`);
} else {
beginTransaction(`${humanize(op)} workbench item`);
}
for (let i = 0; i < objects.length; i++) {
objects[i].saveRect();
}
commitTransaction();
}
}
示例5: updateGroup
export function updateGroup(changes: Partial<IGroup>) {
beginTransaction("Edit shortcuts group");
if (changes.name) {
const group = groups.get(changes.id!);
if (group && group.name != changes.name) {
values(shortcuts)
.filter(shortcut => shortcut.groupName === group.name)
.forEach(shortcut =>
shortcutsStore.updateObject({
id: shortcut.id,
groupName: changes.name
})
);
}
}
store.updateObject(changes);
commitTransaction();
}
示例6: addGroup
export function addGroup(group: Partial<IGroup>) {
beginTransaction("Add shortcuts group");
let result = store.createObject(group);
commitTransaction();
return result;
}