Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
Rueda del ratón (zoom) sobre lienzo img

Reaccionar principiante aquí, tengo un lienzo donde está img, quería implementar el zoom cuando el usuario toma el mouse sobre la imagen, luego el usuario puede acercar y alejar con la rueda del mouse, lo implementé correctamente porque ahora es posible acercar y alejar la imagen, pero obtuve un problema, img se vuelve más pequeño (pero el zoom funciona), si elimino 'TransformComponent', entonces img se vuelve más grande (como debería ser de este tamaño) pero el usuario ya no puede hacer zoom.

El inglés no es mi lengua materna, por lo que podría haber errores.

 import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch"; renderPreview() { const camera = this.props.currentCamera; // render size (not display size) of the canvas const canvasRenderWidth = camera ? camera.width : this.state.config.previewStyle.width; const canvasRenderHeight = camera ? camera.height : this.state.config.previewStyle.height; // display size of the canvas let canvasStyle = { width: canvasRenderWidth >= canvasRenderHeight ? "100%" : "auto", height: canvasRenderHeight > canvasRenderWidth ? "100%" : "auto", }; return ( <div style={this.state.config.previewStyle}> <TransformWrapper > <TransformComponent> <canvas ref="CameraPreviewCanvas" width={canvasRenderWidth} height={canvasRenderHeight} onClick={this.onClickCanvas} onMouseMove={this.onMouseOverCanvas} style={canvasStyle} ></canvas> </TransformComponent> </TransformWrapper> <img ref="CameraPreviewImage" src={this.state.snapshot.snapshotUrl} style={{ display: "none" }} ></img> </div> ); }

imagen:

ingrese la descripción de la imagen aquí

quiero que el ancho de img sea del 100% tal como está sin 'TransformComponent'

Algúna idea de cómo arreglar esto ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!