Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 17 additions & 26 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,6 @@ class Zoom extends Component {
mouseY: null,
}

const {
height,
img,
transitionTime,
width,
} = props

this.outerDivStyle = {
height: `${height}px`,
width: `${width}px`,
overflow: 'hidden',
}

this.innerDivStyle = {
height: `${height}px`,
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center',
backgroundSize: 'auto 100%',
transition: `transform ${transitionTime}s ease-out`,
backgroundImage: `url('${img}')`,
}

this.imageRef = createRef()

this.handleMouseOver = this.handleMouseOver.bind(this)
Expand Down Expand Up @@ -85,17 +63,30 @@ class Zoom extends Component {
zoom,
} = this.state

const {
zoomScale,
} = this.props
const { zoomScale, height, width, img, transitionTime } = this.props

const transform = {
transformOrigin: `${mouseX}% ${mouseY}%`,
}

const outerDivStyle = {
height: `${height}px`,
width: `${width}px`,
overflow: "hidden",
};

const innerDivStyle = {
height: `${height}px`,
backgroundRepeat: "no-repeat",
backgroundPosition: "center",
backgroundSize: "auto 100%",
transition: `transform ${transitionTime}s ease-out`,
backgroundImage: `url('${img}')`,
};

return (
<div
style={this.outerDivStyle}
style={outerDivStyle}
onMouseOver={this.handleMouseOver}
onMouseOut={this.handleMouseOut}
onMouseMove={this.handleMouseMovement}
Expand Down