当前位置: 首页>>代码示例>>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;未经允许,请勿转载。