Skip to content

This package allows us to load a SVG file remotely into react-svg-pan-zoom component.

Notifications You must be signed in to change notification settings

m-ueta/react-svg-pan-zoom-loader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-svg-pan-zoom-loader

This package allows us to load a SVG file remotely into react-svg-pan-zoom component.

Installation

YARN

yarn add react-svg-pan-zoom-loader

NPM

npm install --save react-svg-pan-zoom-loader

Usage

Example 1 :

import {ReactSvgPanZoomLoader} from 'react-svg-pan-zoom-loader'

...

return (
    <ReactSvgPanZoomLoader src="file/path/image.svg" render= {(content) => (
        <ReactSVGPanZoom width={500} height={500}>
            <svg width={500} height={500} >
                {content}
            </svg>  
        </ReactSVGPanZoom>
    )}/>
)

Example 2 with proxy node prop type, under here we can manipulate svg element attributes <SvgLoaderSelectElement/> component.

import {ReactSvgPanZoomLoader, SvgLoaderSelectElement} from 'react-svg-pan-zoom-loader'

...

return (
    <ReactSvgPanZoomLoader src="file/path/image.svg" proxy = {
        <> 
            <SvgLoaderSelectElement selector="#tree" onClick={onItemClick} 
            stroke={props.strokeColor}/> 
        </> 
    } render= {(content) => (

        <ReactSVGPanZoom width={500} height={500}>
            <svg width={500} height={500} >
                {content}
            </svg>  
        </ReactSVGPanZoom>

    )}/>
)

Live Demo

Edit react-svg-pan-zoom-loader

Contributors

About

This package allows us to load a SVG file remotely into react-svg-pan-zoom component.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 72.0%
  • JavaScript 28.0%