當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript store.commitTransaction函數代碼示例

本文整理匯總了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();
 });
開發者ID:eez-open,項目名稱:studio,代碼行數:10,代碼來源:instrument-extension.ts

示例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();
    }
開發者ID:eez-open,項目名稱:studio,代碼行數:11,代碼來源:store.ts

示例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();
}
開發者ID:eez-open,項目名稱:studio,代碼行數:11,代碼來源:groups-store.ts

示例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();
        }
    }
開發者ID:eez-open,項目名稱:studio,代碼行數:15,代碼來源:store.ts

示例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();
}
開發者ID:eez-open,項目名稱:studio,代碼行數:21,代碼來源:groups-store.ts

示例6: addGroup

export function addGroup(group: Partial<IGroup>) {
    beginTransaction("Add shortcuts group");
    let result = store.createObject(group);
    commitTransaction();
    return result;
}
開發者ID:eez-open,項目名稱:studio,代碼行數:6,代碼來源:groups-store.ts


注:本文中的eez-studio-shared/store.commitTransaction函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。