Repository: excalidraw/excalidraw
File: src/renderer/renderElement.ts (TypeScript)

Code before:
      context.scale(
        elementWithCanvas.element.scale[0],
        elementWithCanvas.element.scale[1],
      );
    }

    // revert afterwards we don't have account for it during drawing
    context.translate(-cx, -cy);

    context.drawImage(
      elementWithCanvas.canvas!,
      (x1 + renderConfig.scrollX) * window.devicePixelRatio -
        (padding * elementWithCanvas.canvasZoom) / elementWithCanvas.canvasZoom,
      (y1 + renderConfig.scrollY) * window.devicePixelRatio -
        (padding * elementWithCanvas.canvasZoom) / elementWithCanvas.canvasZoom,
      elementWithCanvas.canvas!.width / elementWithCanvas.canvasZoom,
      elementWithCanvas.canvas!.height / elementWithCanvas.canvasZoom,
    );

    if (
      process.env.REACT_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX &&
      hasBoundTextElement(element)
    ) {
      const coords = getContainerCoords(element);
      context.save();
      context.restore();
      context.strokeStyle = "red";
      context.lineWidth = 3;
      context.strokeRect(
        (coords.x + renderConfig.scrollX) * window.devicePixelRatio,
        (coords.y + renderConfig.scrollY) * window.devicePixelRatio,
        getMaxContainerWidth(element) * window.devicePixelRatio,
        getMaxContainerHeight(element) * window.devicePixelRatio,
      );
    }
  }
  context.restore();

  // Clear the nested element we appended to the DOM
};

export const renderElement = (
  element: NonDeletedExcalidrawElement,
  rc: RoughCanvas,
  context: CanvasRenderingContext2D,
  renderConfig: RenderConfig,
  appState: AppState,
) => {
  const generator = rc.generator;
  switch (element.type) {
    case "selection": {

Review comment (suggestion):
```suggestion
```
Dead code, would be same even if not there, as we are not saving anything and just restoring it back. so..!

Code after:
      context.scale(
        elementWithCanvas.element.scale[0],
        elementWithCanvas.element.scale[1],
      );
    }

    // revert afterwards we don't have account for it during drawing
    context.translate(-cx, -cy);

    context.drawImage(
      elementWithCanvas.canvas!,
      (x1 + renderConfig.scrollX) * window.devicePixelRatio -
        (padding * elementWithCanvas.canvasZoom) / elementWithCanvas.canvasZoom,
      (y1 + renderConfig.scrollY) * window.devicePixelRatio -
        (padding * elementWithCanvas.canvasZoom) / elementWithCanvas.canvasZoom,
      elementWithCanvas.canvas!.width / elementWithCanvas.canvasZoom,
      elementWithCanvas.canvas!.height / elementWithCanvas.canvasZoom,
    );

    if (
      process.env.REACT_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX &&
      hasBoundTextElement(element)
    ) {
      const coords = getContainerCoords(element);
      context.strokeStyle = "#c92a2a";
      context.lineWidth = 3;
      context.strokeRect(
        (coords.x + renderConfig.scrollX) * window.devicePixelRatio,
        (coords.y + renderConfig.scrollY) * window.devicePixelRatio,
        getMaxContainerWidth(element) * window.devicePixelRatio,
        getMaxContainerHeight(element) * window.devicePixelRatio,
      );
    }
  }
  context.restore();

  // Clear the nested element we appended to the DOM
};

export const renderElement = (
  element: NonDeletedExcalidrawElement,
  rc: RoughCanvas,
  context: CanvasRenderingContext2D,
  renderConfig: RenderConfig,
  appState: AppState,
) => {
  const generator = rc.generator;
  switch (element.type) {
    case "selection": {
      context.save();
      context.translate(