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

Adding in target property support for area objects #72

Open
wants to merge 2 commits 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ Its structure is similar to the HTML syntax of mapping:
|**coords**|*array of number*|Coordinates delimiting the zone according to the specified shape: <ul><li>**rect**: `top-left-X`,`top-left-Y`,`bottom-right-X`,`bottom-right-Y`</li><li>**circle**: `center-X`,`center-Y`,`radius`</li><li>**poly**: Every point in the polygon path as `point-X`,`point-Y`,...</li></ul>|required| |**active**|*string*|Enable/Disable highlighting|true|
|**disabled**|*string*|Enable/Disable area listeners and highlighting|false|
|**href**|*string*|Target link for a click in the zone (note that if you provide an onClick prop, `href` will be prevented)|undefined|
|**target**|*string*|_blank,_self|undefined|
|**fillColor**|*string*|Fill color of the highlighted zone|rgba(255, 255, 255, 0.5)|
|**strokeColor**|*string*|Border color of the highlighted zone|rgba(0, 0, 0, 0.5)|
|**lineWidth**|*string*|Border thickness of the highlighted zone|1|
Expand Down
1 change: 1 addition & 0 deletions src/ImageMapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ const ImageMapper: React.FC<ImageMapperProps> = (props: ImageMapperProps) => {
{...(area.preFillColor ? { className: 'img-mapper-area-highlighted' } : {})}
key={area[areaKeyName] || index.toString()}
shape={area.shape}
{...area.target?{target:area.target}:{}}
coords={scaledCoords.join(',')}
onMouseEnter={event => hoverOn(extendedArea, index, event)}
onMouseLeave={event => hoverOff(extendedArea, index, event)}
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface MapAreas {
active?: boolean;
disabled?: boolean;
href?: string;
target?: string;
fillColor?: string;
strokeColor?: string;
lineWidth?: number;
Expand Down