Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement imageOtherProps prop #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/GlassMagnifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const GlassMagnifier = props => {
imageSrc,
largeImageSrc,
imageAlt,
imageOtherProps,
magnifierBorderSize,
magnifierBorderColor,
magnifierBackgroundColor,
Expand Down Expand Up @@ -54,6 +55,7 @@ const GlassMagnifier = props => {
imageSrc={imageSrc}
largeImageSrc={largeImageSrc}
imageAlt={imageAlt}
imageOtherProps={imageOtherProps}
square={square}
magnifierOffsetX={magnifierOffsetX}
magnifierOffsetY={magnifierOffsetY}
Expand All @@ -76,6 +78,7 @@ GlassMagnifier.propTypes = {
PropTypes.arrayOf(PropTypes.string)
]),
imageAlt: PropTypes.string,
imageOtherProps: PropTypes.object,
allowOverflow: PropTypes.bool,
magnifierBorderSize: PropTypes.number,
magnifierBorderColor: PropTypes.string,
Expand All @@ -96,6 +99,7 @@ GlassMagnifier.defaultProps = {
imageSrc: "",
largeImageSrc: "",
imageAlt: "",
imageOtherProps: {},
allowOverflow: false,
magnifierBorderSize: 3,
magnifierBorderColor: "rgba(255,255,255,.5)",
Expand Down
3 changes: 3 additions & 0 deletions src/GlassRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const GlassRenderer = props => {
imageSrc,
largeImageSrc,
imageAlt,
imageOtherProps,
magnifierBorderSize,
magnifierBorderColor,
magnifierBackgroundColor,
Expand Down Expand Up @@ -53,6 +54,7 @@ const GlassRenderer = props => {
return (
<React.Fragment>
<Image
{...(imageOtherProps || {})}
style={{
width: "100%",
display: "block",
Expand Down Expand Up @@ -81,6 +83,7 @@ const GlassRenderer = props => {
}}
>
<Image
{...(imageOtherProps || {})}
style={styles.getLargeImageStyle(position.x, position.y, isActive)}
ref={itemRef}
src={largeImageSrc || imageSrc}
Expand Down
4 changes: 4 additions & 0 deletions src/Magnifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const Magnifier = props => {
imageSrc,
largeImageSrc,
imageAlt,
imageOtherProps,
cursorStyle,
cursorStyleActive,
renderOverlay,
Expand Down Expand Up @@ -50,6 +51,7 @@ const Magnifier = props => {
imageSrc={imageSrc}
largeImageSrc={largeImageSrc}
imageAlt={imageAlt}
imageOtherProps={imageOtherProps}
renderOverlay={renderOverlay}
cursorStyle={cursorStyle}
cursorStyleActive={finalActiveCursorStyle}
Expand All @@ -72,6 +74,7 @@ Magnifier.propTypes = {
PropTypes.arrayOf(PropTypes.string)
]),
imageAlt: PropTypes.string,
imageOtherProps: PropTypes.object,
cursorStyle: PropTypes.string,
cursorStyleActive: PropTypes.string,
renderOverlay: PropTypes.func,
Expand All @@ -95,6 +98,7 @@ Magnifier.defaultProps = {
imageSrc: "",
largeImageSrc: "",
imageAlt: "",
imageOtherProps: {},
cursorStyle: "zoom-in",
cursorStyleActive: "",
dragToMove: true,
Expand Down
4 changes: 4 additions & 0 deletions src/MagnifierPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function MagnifierPreview(props) {
const {
imageSrc,
imageAlt,
imageOtherProps,
largeImageSrc,
className,
style,
Expand Down Expand Up @@ -60,6 +61,7 @@ function MagnifierPreview(props) {
image={imageSrc}
largeImage={largeImageSrc}
alt={imageAlt}
imageOtherProps={imageOtherProps}
zoomImageDimensions={zoomImageDimensions}
previewSize={previewSize}
smallImageSize={smallImageSize}
Expand Down Expand Up @@ -93,6 +95,7 @@ MagnifierPreview.propTypes = {
PropTypes.arrayOf(PropTypes.string)
]),
imageAlt: PropTypes.string,
imageOtherProps: PropTypes.object,
onImageLoad: PropTypes.func,
onLargeImageLoad: PropTypes.func,
renderOverlay: PropTypes.func,
Expand All @@ -111,6 +114,7 @@ MagnifierPreview.defaultProps = {
cursorStyle: "crosshair",
imageSrc: "",
imageAlt: "",
imageOtherProps: {},
overlayOpacity: 0.5,
overlayBoxOpacity: 0.8,
overlayBackgroundColor: "#000",
Expand Down
2 changes: 2 additions & 0 deletions src/MagnifierPreviewRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function MagnifierPreviewRenderer(props) {
image,
largeImage,
alt,
imageOtherProps,
previewSize,
smallImageSize,
overlayOpacity,
Expand Down Expand Up @@ -71,6 +72,7 @@ function MagnifierPreviewRenderer(props) {
}}
>
<Image
{...(imageOtherProps || {})}
style={{
...styles.getLargeImageStyle(position.x, position.y, inPlace)
}}
Expand Down
3 changes: 3 additions & 0 deletions src/MagnifierRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const MagnifierRenderer = props => {
imageSrc,
largeImageSrc,
imageAlt,
imageOtherProps,
itemRef,
renderOverlay,
cursorStyle,
Expand All @@ -31,6 +32,7 @@ const MagnifierRenderer = props => {
return (
<div style={{ position: "relative", cursor: finalCursorStyle }}>
<Image
{...(imageOtherProps || {})}
style={{
display: "block",
visibility: isActive ? "hidden" : "visible",
Expand All @@ -49,6 +51,7 @@ const MagnifierRenderer = props => {
)}
>
<Image
{...(imageOtherProps || {})}
style={styles.getLargeImageStyle(
itemPosition.x,
itemPosition.y,
Expand Down
4 changes: 4 additions & 0 deletions src/MagnifierZoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function MagnifierZoom(props) {
const {
imageSrc,
imageAlt,
imageOtherProps,
className,
style,
onImageLoad,
Expand Down Expand Up @@ -43,6 +44,7 @@ function MagnifierZoom(props) {
ref={zoomRef}
>
<Image
{...(imageOtherProps || {})}
ref={zoomImageRef}
style={{
...styles.getLargeImageStyle(
Expand Down Expand Up @@ -70,6 +72,7 @@ MagnifierZoom.propTypes = {
PropTypes.arrayOf(PropTypes.string)
]),
imageAlt: PropTypes.string,
imageOtherProps: PropTypes.object,
onImageLoad: PropTypes.func,
transitionSpeed: PropTypes.number
};
Expand All @@ -78,6 +81,7 @@ MagnifierZoom.defaultProps = {
style: {},
imageSrc: "",
imageAlt: "",
imageOtherProps: {},
onImageLoad: utils.noop,
transitionSpeed: 0.4
};
Expand Down
4 changes: 4 additions & 0 deletions src/PictureInPictureMagnifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class PictureInPictureMagnifier extends Component {
PropTypes.arrayOf(PropTypes.string)
]),
imageAlt: PropTypes.string,
imageOtherProps: PropTypes.object,
previewSizePercentage: PropTypes.number,
previewHorizontalPos: PropTypes.oneOf(["left", "right"]),
previewVerticalPos: PropTypes.oneOf(["top", "bottom"]),
Expand Down Expand Up @@ -47,6 +48,7 @@ class PictureInPictureMagnifier extends Component {
imageSrc: "",
largeImageSrc: "",
imageAlt: "",
imageOtherProps: {},
previewSizePercentage: 35,
previewHorizontalPos: "left",
previewVerticalPos: "bottom",
Expand All @@ -69,6 +71,7 @@ class PictureInPictureMagnifier extends Component {
imageSrc,
largeImageSrc,
imageAlt,
imageOtherProps,
previewSizePercentage,
previewHorizontalPos,
previewVerticalPos,
Expand Down Expand Up @@ -135,6 +138,7 @@ class PictureInPictureMagnifier extends Component {
imageSrc={imageSrc}
largeImageSrc={largeImageSrc}
imageAlt={imageAlt}
imageOtherProps={imageOtherProps}
renderOverlay={renderOverlay}
cursorStyle={cursorStyle}
cursorStyleActive={cursorStyleActive || cursorStyle}
Expand Down
3 changes: 3 additions & 0 deletions src/PictureInPictureRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const PictureInPictureRenderer = props => {
imageSrc,
largeImageSrc,
imageAlt,
imageOtherProps,
itemRef,
previewSizePercentage,
containerRef,
Expand Down Expand Up @@ -140,6 +141,7 @@ const PictureInPictureRenderer = props => {
}}
>
<Image
{...(imageOtherProps || {})}
style={{
width: "100%",
display: "block",
Expand Down Expand Up @@ -170,6 +172,7 @@ const PictureInPictureRenderer = props => {
}}
>
<Image
{...(imageOtherProps || {})}
style={{
...styles.getLargeImageStyle(position.x, position.y, true),
visibility: legalSize ? "visible" : "hidden",
Expand Down
4 changes: 4 additions & 0 deletions src/SideBySideMagnifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const SideBySideMagnifier = props => {
imageSrc,
largeImageSrc,
imageAlt,
imageOtherProps,
overlayOpacity,
overlayBoxOpacity,
overlayBackgroundColor,
Expand Down Expand Up @@ -58,6 +59,7 @@ const SideBySideMagnifier = props => {
imageSrc={imageSrc}
largeImageSrc={largeImageSrc}
imageAlt={imageAlt}
imageOtherProps={imageOtherProps}
overlayOpacity={overlayOpacity}
overlayBoxOpacity={overlayBoxOpacity}
overlayBackgroundColor={overlayBackgroundColor}
Expand Down Expand Up @@ -96,6 +98,7 @@ SideBySideMagnifier.propTypes = {
PropTypes.arrayOf(PropTypes.string)
]),
imageAlt: PropTypes.string,
imageOtherProps: PropTypes.object,
overlayOpacity: PropTypes.number,
overlayBoxOpacity: PropTypes.number,
overlayBackgroundColor: PropTypes.string,
Expand Down Expand Up @@ -128,6 +131,7 @@ SideBySideMagnifier.defaultProps = {
imageSrc: "",
largeImageSrc: "",
imageAlt: "",
imageOtherProps: {},
overlayOpacity: 0.5,
overlayBoxOpacity: 0.8,
overlayBackgroundColor: "#000",
Expand Down
3 changes: 3 additions & 0 deletions src/SideBySideRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const SideBySideRenderer = props => {
imageSrc,
largeImageSrc,
imageAlt,
imageOtherProps,
itemRef,
overlayOpacity,
overlayBoxOpacity,
Expand Down Expand Up @@ -197,6 +198,7 @@ const SideBySideRenderer = props => {
return (
<div style={{ position: "relative" }}>
<Image
{...(imageOtherProps || {})}
style={{
width: "100%",
display: "block",
Expand Down Expand Up @@ -224,6 +226,7 @@ const SideBySideRenderer = props => {
}}
>
<Image
{...(imageOtherProps || {})}
style={styles.getLargeImageStyle(position.x, position.y, true)}
src={largeImageSrc || imageSrc}
alt={imageAlt}
Expand Down