How to use the @bentley/ui-framework.ContentViewManager.getActiveContentControl function in @bentley/ui-framework

To help you get started, we’ve selected a few @bentley/ui-framework examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / AnalysisAnimationToolSettings.tsx View on Github external
private _stopAnimation = () => {
    if (!this.state.isAnimating)
      return; // already not animating!
    this.setState({ isAnimating: false, isAnimationPaused: false, elapsedTime: 0 });

    const activeContentControl = ContentViewManager.getActiveContentControl();
    if (activeContentControl && activeContentControl.viewport) {
      activeContentControl.viewport.animationFraction = 0;
    }
    window.cancelAnimationFrame(this._requestFrame);
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / appui / frontstages / ViewsFrontstage.tsx View on Github external
execute: async () => {
      const activeContentControl = ContentViewManager.getActiveContentControl();
      if (activeContentControl && activeContentControl.viewport &&
        (undefined !== activeContentControl.viewport.view.analysisStyle || undefined !== activeContentControl.viewport.view.scheduleScript)) {
        const frontstageProvider = new NestedAnimationStage();
        const frontstageDef = frontstageProvider.initializeDef();
        SampleAppIModelApp.saveAnimationViewId(activeContentControl.viewport.view.id);
        await FrontstageManager.openNestedFrontstage(frontstageDef);
      }
    },
    isVisible: false, // default to not show and then allow stateFunc to redefine.
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / appui / statusfields / DisplayStyleField.tsx View on Github external
public componentDidMount() {
    FrontstageManager.onContentControlActivatedEvent.addListener(this._handleContentControlActivatedEvent);

    // tslint:disable-next-line: no-floating-promises
    this.setStateFromActiveContent(ContentViewManager.getActiveContentControl());
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / appui / contentviews / ScheduleAnimationViewport.tsx View on Github external
private _onAnimationFractionChanged = (animationFraction: number) => {
    if (this.state.dataProvider && undefined === this.state.dataProvider.viewport) {
      const activeContentControl = ContentViewManager.getActiveContentControl();
      if (activeContentControl && activeContentControl.viewport) {
        if (this.state.viewId === activeContentControl.viewport.view.id)
          this.state.dataProvider.viewport = activeContentControl.viewport;
      }
    }

    if (this.state.dataProvider && this.state.dataProvider.onAnimationFractionChanged)
      this.state.dataProvider.onAnimationFractionChanged(animationFraction);
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / ToolSpecifications.tsx View on Github external
stateFunc: (currentState: Readonly): BaseItemState => {
        const returnState: BaseItemState = { ...currentState };
        returnState.isVisible = ContentViewManager.isContent3dView(ContentViewManager.getActiveContentControl());
        return returnState;
      },
    });
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / appui / statusfields / ShadowField.tsx View on Github external
public componentDidMount() {
    FrontstageManager.onContentControlActivatedEvent.addListener(this._handleContentControlActivatedEvent);
    this.setStateFromActiveContent(ContentViewManager.getActiveContentControl());
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / AnalysisAnimationToolSettings.tsx View on Github external
public componentWillUnmount() {
    const activeContentControl = ContentViewManager.getActiveContentControl();
    if (activeContentControl && activeContentControl.viewport) {
      activeContentControl.viewport.animationFraction = 0;
      window.cancelAnimationFrame(this._requestFrame);
    }
    this._unmounted = true;
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / appui / frontstages / ViewsFrontstage.tsx View on Github external
private _anotherGroupStateFunc = (currentState: Readonly): BaseItemState => {
    const returnState: BaseItemState = { ...currentState };
    returnState.isVisible = ContentViewManager.isContent3dView(ContentViewManager.getActiveContentControl());
    return returnState;
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / ToolSpecifications.tsx View on Github external
stateFunc: (currentState: Readonly): BaseItemState => {
        const returnState: BaseItemState = { ...currentState };
        const activeContentControl = ContentViewManager.getActiveContentControl();

        if (activeContentControl && activeContentControl.viewport && (undefined !== activeContentControl.viewport.view.analysisStyle))
          returnState.isVisible = true;
        else
          returnState.isVisible = false;
        return returnState;
      },
    });
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / appui / contentviews / ScheduleAnimationViewport.tsx View on Github external
public componentWillUnmount() {
    const activeContentControl = ContentViewManager.getActiveContentControl();
    if (activeContentControl && activeContentControl.viewport) {
      activeContentControl.viewport.animationFraction = 0;
    }
  }