本文整理汇总了TypeScript中app/store.Store类的典型用法代码示例。如果您正苦于以下问题:TypeScript Store类的具体用法?TypeScript Store怎么用?TypeScript Store使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Store类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: closeActionMode
closeActionMode() {
const mode = this.getActionMode();
if (mode === ActionMode.None) {
return;
}
if (mode === ActionMode.Selection) {
if (this.queryStore(getActionModeSelections).length) {
// TODO: move this logic out into a component (it's confusing)
this.store.dispatch(new SetActionModeSelections([]));
} else {
this.store.dispatch(new SetActionMode(ActionMode.None));
}
} else {
this.store.dispatch(new SetActionMode(ActionMode.Selection));
}
}
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:16,代码来源:actionmode.service.ts
示例2:
private queryStore<T>(selector: OutputSelector<Object, T, (res: Object) => T>) {
let obj: T;
this.store
.select(selector)
.pipe(first())
.subscribe(o => (obj = o));
return obj;
}
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:8,代码来源:layertimeline.service.ts
示例3: onSuccess
private onSuccess(
importType: ImportType,
resetWorkspace: boolean,
vls: ReadonlyArray<VectorLayer>,
animation?: Animation,
hiddenLayerIds?: ReadonlySet<string>,
) {
if (importType === ImportType.Json) {
ga('send', 'event', 'Import', 'JSON');
this.store.dispatch(new ResetWorkspace(vls[0], animation, hiddenLayerIds));
} else {
if (importType === ImportType.Svg) {
ga('send', 'event', 'Import', 'SVG');
} else if (importType === ImportType.VectorDrawable) {
ga('send', 'event', 'Import', 'Vector Drawable');
}
if (resetWorkspace) {
this.store.dispatch(new ResetWorkspace());
}
this.layerTimelineService.importLayers(vls);
// TODO: count number of individual layers?
this.snackBarService.show(
`Imported ${vls.length} layer${vls.length === 1 ? '' : 's'}`,
'Dismiss',
Duration.Short,
);
}
}
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:28,代码来源:fileimport.service.ts
示例4: toggleSubPathSelection
toggleSubPathSelection(source: ActionSource, subIdx: number) {
const selections = [...this.getSelections()];
_.remove(selections, s => s.type !== SelectionType.SubPath || s.source !== source);
const type = SelectionType.SubPath;
const toggledSelections = this.toggleSelections(selections, [{ type, source, subIdx }]);
this.store.dispatch(new SetActionModeSelections(toggledSelections));
}
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:7,代码来源:actionmode.service.ts
示例5: SetVectorLayer
/**
* Replaces an existing layer in the tree with a new layer. Note that
* this method assumes that both layers still have the same children layers.
*/
swapLayers(layerId: string, newLayer: Layer) {
if (layerId === newLayer.id) {
this.updateLayer(newLayer);
return;
}
const vl = this.getVectorLayer();
const parent = LayerUtil.findParent(vl, layerId).clone();
const layerIndex = _.findIndex(parent.children, l => l.id === layerId);
const children = [...parent.children];
children.splice(layerIndex, 1, newLayer);
parent.children = children;
const actions: Action[] = [
new SetVectorLayer(LayerUtil.updateLayer(vl, parent)),
...this.buildCleanupLayerIdActions(layerId),
];
const animation = this.getAnimation();
const oldLayerBlocks = animation.blocks.filter(b => b.layerId === layerId);
const newAnimatableProperties = new Set(newLayer.animatableProperties.keys());
// Preserve any blocks that are still animatable with the new layer.
const newLayerBlocks = oldLayerBlocks
.filter(b => newAnimatableProperties.has(b.propertyName))
.map(b => {
b = b.clone();
b.layerId = newLayer.id;
return b;
});
const newAnimation = animation.clone();
newAnimation.blocks = [
...animation.blocks.filter(b => b.layerId !== layerId),
...newLayerBlocks,
];
actions.push(new SetAnimation(newAnimation));
this.store.dispatch(new BatchAction(...actions));
}
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:38,代码来源:layertimeline.service.ts
示例6: shiftPointToFront
shiftPointToFront() {
const selections = this.getSelections().filter(s => s.type === SelectionType.Point);
const { source, subIdx, cmdIdx } = selections[0];
const activePath = this.getActivePathBlockValue(source);
const pm = activePath.mutate();
pm.shiftSubPathForward(subIdx, cmdIdx);
this.store.dispatch(this.buildUpdatedActivePathBlockAnimationAction(source, pm.build()));
}
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:8,代码来源:actionmode.service.ts
示例7: vectorLayer
private get vectorLayer() {
let vectorLayer: VectorLayer;
this.store
.select(getVectorLayer)
.pipe(first())
.subscribe(vl => (vectorLayer = vl));
return vectorLayer;
}
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:8,代码来源:fileimport.service.ts
示例8: getHiddenLayerIds
private getHiddenLayerIds() {
let hiddenLayerIds: ReadonlySet<string>;
this.store
.select(getHiddenLayerIds)
.pipe(first())
.subscribe(ids => (hiddenLayerIds = ids));
return hiddenLayerIds;
}
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:8,代码来源:fileexport.service.ts
示例9: getThemeType
getThemeType() {
let result: { themeType: ThemeType; isInitialPageLoad: boolean };
this.store
.select(getThemeType)
.pipe(first())
.subscribe(res => (result = res));
return result;
}
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:8,代码来源:theme.service.ts
示例10: getAnimation
private getAnimation() {
let animation: Animation;
this.store
.select(getAnimation)
.pipe(first())
.subscribe(anim => (animation = anim));
return animation;
}
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:8,代码来源:fileexport.service.ts
注:本文中的app/store.Store类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论