本文整理匯總了TypeScript中app/site/base/projectable.isProjectable函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isProjectable函數的具體用法?TypeScript isProjectable怎麽用?TypeScript isProjectable使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了isProjectable函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: openProjectDialogFor
/**
* Opens the projection dialog for the given projectable. After the user's choice,
* the projectors will be updated.
*
* @param obj The projectable.
*/
public async openProjectDialogFor(obj: Projectable | ProjectorElementBuildDeskriptor): Promise<void> {
let descriptor: ProjectorElementBuildDeskriptor;
if (isProjectable(obj)) {
descriptor = obj.getSlide(this.configService);
} else {
descriptor = obj;
}
const dialogRef = this.dialog.open<
ProjectionDialogComponent,
ProjectorElementBuildDeskriptor,
ProjectionDialogReturnType
>(ProjectionDialogComponent, {
maxHeight: '90vh',
autoFocus: false,
data: descriptor
});
const response = await dialogRef.afterClosed().toPromise();
if (response) {
const [action, projectors, projectorElement]: ProjectionDialogReturnType = response;
if (action === 'project') {
this.projectorService.projectOnMultiple(projectors, projectorElement);
} else if (action === 'addToPreview') {
projectors.forEach(projector => {
this.projectorService.addElementToPreview(projector, projectorElement);
});
}
}
}
示例2:
/**
* Returns a view model associated with the identifiable projector element. Throws an error,
* if the element is not mappable.
*
* @param element The projector element
* @returns the view model from the projector element
*/
public getViewModelFromProjectorElement<T extends BaseProjectableViewModel>(
element: IdentifiableProjectorElement
): T {
this.assertElementIsMappable(element);
const viewModel = this.viewModelStore.get<T>(element.name, element.id);
if (viewModel && !isProjectable(viewModel)) {
console.error('The view model is not projectable', viewModel, element);
}
return viewModel;
}
示例3: getProjectorElement
/**
* Retusn the identifiable projector element from the given types of slides/elements/descriptors
*
* @param obj Something related to IdentifiableProjectorElement
* @returns the identifiable projector element from obj.
*/
private getProjectorElement(
obj: Projectable | ProjectorElementBuildDeskriptor | IdentifiableProjectorElement
): IdentifiableProjectorElement {
if (isProjectable(obj)) {
return obj.getSlide(this.configService).getBasicProjectorElement({});
} else if (isProjectorElementBuildDeskriptor(obj)) {
return obj.getBasicProjectorElement({});
} else {
return obj;
}
}