本文整理匯總了TypeScript中eez-studio-shared/store.beginTransaction函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript beginTransaction函數的具體用法?TypeScript beginTransaction怎麽用?TypeScript beginTransaction使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了beginTransaction函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: 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();
}
示例2: 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();
}
}
示例3: 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();
});
示例4: 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();
}
示例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;
}