Repository: ManimCommunity/manim
File: manim/scene/zoomed_scene.py (Python)

Code before:
        self.renderer.camera.add_image_mobject_from_camera(self.zoomed_display)  # type: ignore[union-attr]
        if animate:
            self.play(self.get_zoom_in_animation())
            self.play(self.get_zoomed_display_pop_out_animation())
        self.add_foreground_mobjects(
            self.zoomed_camera.frame,
            self.zoomed_display,
        )

    def get_zoom_in_animation(self, run_time: float = 2, **kwargs: Any) -> ApplyMethod:
        """Returns the animation of camera zooming in.

        Parameters
        ----------
        run_time
            The run_time of the animation of the camera zooming in.
        **kwargs
            Any valid keyword arguments of ApplyMethod()

        Returns
        -------
        ApplyMethod
            The animation of the camera zooming in.
        """
        frame = self.zoomed_camera.frame
        if isinstance(self.camera, MovingCamera):
            # OpenGLCamera does not have frame_height and frame_width attributes
            full_frame_height = self.camera.frame_height
            full_frame_width = self.camera.frame_width
        frame.save_state()
        frame.stretch_to_fit_width(full_frame_width)
        frame.stretch_to_fit_height(full_frame_height)
        frame.center()
        frame.set_stroke(width=0)
        return ApplyMethod(frame.restore, run_time=run_time, **kwargs)

    def get_zoomed_display_pop_out_animation(self, **kwargs: Any) -> ApplyMethod:
        """This is the animation of the popping out of the mini-display that
        shows the content of the zoomed camera.

        Returns
        -------
        ApplyMethod
            The Animation of the Zoomed Display popping out.
        """
        display = self.zoomed_display
        display.save_state()
        display.replace(self.zoomed_camera.frame, stretch=True)
        return ApplyMethod(display.restore)

    def get_zoom_factor(self) -> float:

Review comment (suggestion):
`OpenGLCamera` does not have `frame_height` and `frame_width` attributes.
I have not spent enough time with the OpenGL code yet, so this is my suggested solution. 

Code after:
        self.zoom_activated = True
        self.renderer.camera.add_image_mobject_from_camera(self.zoomed_display)  # type: ignore[union-attr]
        if animate:
            self.play(self.get_zoom_in_animation())
            self.play(self.get_zoomed_display_pop_out_animation())
        self.add_foreground_mobjects(
            self.zoomed_camera.frame,
            self.zoomed_display,
        )

    def get_zoom_in_animation(self, run_time: float = 2, **kwargs: Any) -> ApplyMethod:
        """Returns the animation of camera zooming in.

        Parameters
        ----------
        run_time
            The run_time of the animation of the camera zooming in.
        **kwargs
            Any valid keyword arguments of ApplyMethod()

        Returns
        -------
        ApplyMethod
            The animation of the camera zooming in.
        """
        frame = self.zoomed_camera.frame
        if isinstance(self.camera, OpenGLCamera):
            full_frame_width, full_frame_height = self.camera.frame_shape
        else:
            full_frame_height = self.camera.frame_height
            full_frame_width = self.camera.frame_width
        frame.save_state()
        frame.stretch_to_fit_width(full_frame_width)
        frame.stretch_to_fit_height(full_frame_height)
        frame.center()
        frame.set_stroke(width=0)
        return ApplyMethod(frame.restore, run_time=run_time, **kwargs)

    def get_zoomed_display_pop_out_animation(self, **kwargs: Any) -> ApplyMethod:
        """This is the animation of the popping out of the mini-display that
        shows the content of the zoomed camera.

        Returns
        -------
        ApplyMethod
            The Animation of the Zoomed Display popping out.
        """
        display = self.zoomed_display
        display.save_state()
        display.replace(self.zoomed_camera.frame, stretch=True)
        return ApplyMethod(display.restore)