Share
Sign In
📄

react-map-interaction

Add map like zooming and panning to any React element. This works on both touch devices (pinch to zoom, drag to pan) as well as with a mouse or trackpad (wheel scroll to zoom, mouse drag to pan).
Install
npm install --save react-map-interaction
Usage
Basic
Usage without CSS
Controlled
Controlled vs Uncontrolled
Similar to React's <input /> component, you can either control the state of MapInteraction yourself, or let it handle that for you. It is not recommended, however, that you change this mode of control during the lifecycle of a component. Once you have started controlling the state, keep controlling it under you unmount MapInteraction (likewise with uncontrolled). If you pass value prop, we assume you are controlling the state via a onChange prop.
Click and drag handlers on child elements
This component lets you decide how to respond to click/drag events on the children that you render inside of the map. To know if an element was clicked or dragged, you can attach onClick or onTouchEnd events and then check the e.defaultPrevented attribute. MapInteraction will set defaultPrevented to true if the touchend/mouseup event happened after a drag, and false if it was a click. See index.stories.js for an example.
Prop Types for MapInteractionCSS (all optional)
MapInteraction doesn't require any props. It will control its own internal state, and pass values to its children. If you need to control the scale and translation then you can pass those values as props and listen to the onChange event to receive updates.
Prop Types for MapInteraction (all optional)
React 홈으로 돌아가기
React.js
메인으로 돌아가기
Add map like zooming and panning to any React element. This works on both touch devices (pinch to zoom, drag to pan) as well as with a mouse or trackpad (wheel scroll to zoom, mouse drag to pan).
Install
npm install --save react-map-interaction
Usage
Basic
Usage without CSS
Controlled
Controlled vs Uncontrolled
Similar to React's <input /> component, you can either control the state of MapInteraction yourself, or let it handle that for you. It is not recommended, however, that you change this mode of control during the lifecycle of a component. Once you have started controlling the state, keep controlling it under you unmount MapInteraction (likewise with uncontrolled). If you pass value prop, we assume you are controlling the state via a onChange prop.
Click and drag handlers on child elements
This component lets you decide how to respond to click/drag events on the children that you render inside of the map. To know if an element was clicked or dragged, you can attach onClick or onTouchEnd events and then check the e.defaultPrevented attribute. MapInteraction will set defaultPrevented to true if the touchend/mouseup event happened after a drag, and false if it was a click. See index.stories.js for an example.
Prop Types for MapInteractionCSS (all optional)
MapInteraction doesn't require any props. It will control its own internal state, and pass values to its children. If you need to control the scale and translation then you can pass those values as props and listen to the onChange event to receive updates.
Prop Types for MapInteraction (all optional)
React 홈으로 돌아가기
React.js
메인으로 돌아가기
Add map like zooming and panning to any React element. This works on both touch devices (pinch to zoom, drag to pan) as well as with a mouse or trackpad (wheel scroll to zoom, mouse drag to pan).
Install
npm install --save react-map-interaction
Usage
Basic
Usage without CSS
Controlled
Controlled vs Uncontrolled
Similar to React's <input /> component, you can either control the state of MapInteraction yourself, or let it handle that for you. It is not recommended, however, that you change this mode of control during the lifecycle of a component. Once you have started controlling the state, keep controlling it under you unmount MapInteraction (likewise with uncontrolled). If you pass value prop, we assume you are controlling the state via a onChange prop.
Click and drag handlers on child elements
This component lets you decide how to respond to click/drag events on the children that you render inside of the map. To know if an element was clicked or dragged, you can attach onClick or onTouchEnd events and then check the e.defaultPrevented attribute. MapInteraction will set defaultPrevented to true if the touchend/mouseup event happened after a drag, and false if it was a click. See index.stories.js for an example.
Prop Types for MapInteractionCSS (all optional)
MapInteraction doesn't require any props. It will control its own internal state, and pass values to its children. If you need to control the scale and translation then you can pass those values as props and listen to the onChange event to receive updates.
Prop Types for MapInteraction (all optional)
React 홈으로 돌아가기
React.js
메인으로 돌아가기
Add map like zooming and panning to any React element. This works on both touch devices (pinch to zoom, drag to pan) as well as with a mouse or trackpad (wheel scroll to zoom, mouse drag to pan).
Install
npm install --save react-map-interaction
Usage
Basic
Usage without CSS
Controlled
Controlled vs Uncontrolled
Similar to React's <input /> component, you can either control the state of MapInteraction yourself, or let it handle that for you. It is not recommended, however, that you change this mode of control during the lifecycle of a component. Once you have started controlling the state, keep controlling it under you unmount MapInteraction (likewise with uncontrolled). If you pass value prop, we assume you are controlling the state via a onChange prop.
Click and drag handlers on child elements
This component lets you decide how to respond to click/drag events on the children that you render inside of the map. To know if an element was clicked or dragged, you can attach onClick or onTouchEnd events and then check the e.defaultPrevented attribute. MapInteraction will set defaultPrevented to true if the touchend/mouseup event happened after a drag, and false if it was a click. See index.stories.js for an example.
Prop Types for MapInteractionCSS (all optional)
MapInteraction doesn't require any props. It will control its own internal state, and pass values to its children. If you need to control the scale and translation then you can pass those values as props and listen to the onChange event to receive updates.
Prop Types for MapInteraction (all optional)
React 홈으로 돌아가기
React.js
메인으로 돌아가기
Add map like zooming and panning to any React element. This works on both touch devices (pinch to zoom, drag to pan) as well as with a mouse or trackpad (wheel scroll to zoom, mouse drag to pan).
Install
npm install --save react-map-interaction
Usage
Basic
Usage without CSS
Controlled
Controlled vs Uncontrolled
Similar to React's <input /> component, you can either control the state of MapInteraction yourself, or let it handle that for you. It is not recommended, however, that you change this mode of control during the lifecycle of a component. Once you have started controlling the state, keep controlling it under you unmount MapInteraction (likewise with uncontrolled). If you pass value prop, we assume you are controlling the state via a onChange prop.
Click and drag handlers on child elements
This component lets you decide how to respond to click/drag events on the children that you render inside of the map. To know if an element was clicked or dragged, you can attach onClick or onTouchEnd events and then check the e.defaultPrevented attribute. MapInteraction will set defaultPrevented to true if the touchend/mouseup event happened after a drag, and false if it was a click. See index.stories.js for an example.
Prop Types for MapInteractionCSS (all optional)
MapInteraction doesn't require any props. It will control its own internal state, and pass values to its children. If you need to control the scale and translation then you can pass those values as props and listen to the onChange event to receive updates.
Prop Types for MapInteraction (all optional)
React 홈으로 돌아가기
React.js
메인으로 돌아가기
Add map like zooming and panning to any React element. This works on both touch devices (pinch to zoom, drag to pan) as well as with a mouse or trackpad (wheel scroll to zoom, mouse drag to pan).
Install
npm install --save react-map-interaction
Usage
Basic
Usage without CSS
Controlled
Controlled vs Uncontrolled
Similar to React's <input /> component, you can either control the state of MapInteraction yourself, or let it handle that for you. It is not recommended, however, that you change this mode of control during the lifecycle of a component. Once you have started controlling the state, keep controlling it under you unmount MapInteraction (likewise with uncontrolled). If you pass value prop, we assume you are controlling the state via a onChange prop.
Click and drag handlers on child elements
This component lets you decide how to respond to click/drag events on the children that you render inside of the map. To know if an element was clicked or dragged, you can attach onClick or onTouchEnd events and then check the e.defaultPrevented attribute. MapInteraction will set defaultPrevented to true if the touchend/mouseup event happened after a drag, and false if it was a click. See index.stories.js for an example.
Prop Types for MapInteractionCSS (all optional)
MapInteraction doesn't require any props. It will control its own internal state, and pass values to its children. If you need to control the scale and translation then you can pass those values as props and listen to the onChange event to receive updates.
Prop Types for MapInteraction (all optional)
React 홈으로 돌아가기
React.js
메인으로 돌아가기
Add map like zooming and panning to any React element. This works on both touch devices (pinch to zoom, drag to pan) as well as with a mouse or trackpad (wheel scroll to zoom, mouse drag to pan).
Install
npm install --save react-map-interaction
Usage
Basic
Usage without CSS
Controlled
Controlled vs Uncontrolled
Similar to React's <input /> component, you can either control the state of MapInteraction yourself, or let it handle that for you. It is not recommended, however, that you change this mode of control during the lifecycle of a component. Once you have started controlling the state, keep controlling it under you unmount MapInteraction (likewise with uncontrolled). If you pass value prop, we assume you are controlling the state via a onChange prop.
Click and drag handlers on child elements
This component lets you decide how to respond to click/drag events on the children that you render inside of the map. To know if an element was clicked or dragged, you can attach onClick or onTouchEnd events and then check the e.defaultPrevented attribute. MapInteraction will set defaultPrevented to true if the touchend/mouseup event happened after a drag, and false if it was a click. See index.stories.js for an example.
Prop Types for MapInteractionCSS (all optional)
MapInteraction doesn't require any props. It will control its own internal state, and pass values to its children. If you need to control the scale and translation then you can pass those values as props and listen to the onChange event to receive updates.
Prop Types for MapInteraction (all optional)
React 홈으로 돌아가기
React.js
메인으로 돌아가기
Add map like zooming and panning to any React element. This works on both touch devices (pinch to zoom, drag to pan) as well as with a mouse or trackpad (wheel scroll to zoom, mouse drag to pan).
Install
npm install --save react-map-interaction
Usage
Basic
Usage without CSS
Controlled
Controlled vs Uncontrolled
Similar to React's <input /> component, you can either control the state of MapInteraction yourself, or let it handle that for you. It is not recommended, however, that you change this mode of control during the lifecycle of a component. Once you have started controlling the state, keep controlling it under you unmount MapInteraction (likewise with uncontrolled). If you pass value prop, we assume you are controlling the state via a onChange prop.
Click and drag handlers on child elements
This component lets you decide how to respond to click/drag events on the children that you render inside of the map. To know if an element was clicked or dragged, you can attach onClick or onTouchEnd events and then check the e.defaultPrevented attribute. MapInteraction will set defaultPrevented to true if the touchend/mouseup event happened after a drag, and false if it was a click. See index.stories.js for an example.
Prop Types for MapInteractionCSS (all optional)
MapInteraction doesn't require any props. It will control its own internal state, and pass values to its children. If you need to control the scale and translation then you can pass those values as props and listen to the onChange event to receive updates.
Prop Types for MapInteraction (all optional)
React 홈으로 돌아가기
React.js
메인으로 돌아가기
Add map like zooming and panning to any React element. This works on both touch devices (pinch to zoom, drag to pan) as well as with a mouse or trackpad (wheel scroll to zoom, mouse drag to pan).
Install
npm install --save react-map-interaction
Usage
Basic
Usage without CSS
Controlled
Controlled vs Uncontrolled
Similar to React's <input /> component, you can either control the state of MapInteraction yourself, or let it handle that for you. It is not recommended, however, that you change this mode of control during the lifecycle of a component. Once you have started controlling the state, keep controlling it under you unmount MapInteraction (likewise with uncontrolled). If you pass value prop, we assume you are controlling the state via a onChange prop.
Click and drag handlers on child elements
This component lets you decide how to respond to click/drag events on the children that you render inside of the map. To know if an element was clicked or dragged, you can attach onClick or onTouchEnd events and then check the e.defaultPrevented attribute. MapInteraction will set defaultPrevented to true if the touchend/mouseup event happened after a drag, and false if it was a click. See index.stories.js for an example.
Prop Types for MapInteractionCSS (all optional)
MapInteraction doesn't require any props. It will control its own internal state, and pass values to its children. If you need to control the scale and translation then you can pass those values as props and listen to the onChange event to receive updates.
Prop Types for MapInteraction (all optional)
React 홈으로 돌아가기
React.js
메인으로 돌아가기
Add map like zooming and panning to any React element. This works on both touch devices (pinch to zoom, drag to pan) as well as with a mouse or trackpad (wheel scroll to zoom, mouse drag to pan).
Install
npm install --save react-map-interaction
Usage
Basic
Usage without CSS
Controlled
Controlled vs Uncontrolled
Similar to React's <input /> component, you can either control the state of MapInteraction yourself, or let it handle that for you. It is not recommended, however, that you change this mode of control during the lifecycle of a component. Once you have started controlling the state, keep controlling it under you unmount MapInteraction (likewise with uncontrolled). If you pass value prop, we assume you are controlling the state via a onChange prop.
Click and drag handlers on child elements
This component lets you decide how to respond to click/drag events on the children that you render inside of the map. To know if an element was clicked or dragged, you can attach onClick or onTouchEnd events and then check the e.defaultPrevented attribute. MapInteraction will set defaultPrevented to true if the touchend/mouseup event happened after a drag, and false if it was a click. See index.stories.js for an example.
Prop Types for MapInteractionCSS (all optional)
MapInteraction doesn't require any props. It will control its own internal state, and pass values to its children. If you need to control the scale and translation then you can pass those values as props and listen to the onChange event to receive updates.
Prop Types for MapInteraction (all optional)
React 홈으로 돌아가기
React.js
메인으로 돌아가기
Add map like zooming and panning to any React element. This works on both touch devices (pinch to zoom, drag to pan) as well as with a mouse or trackpad (wheel scroll to zoom, mouse drag to pan).
Install
npm install --save react-map-interaction
Usage
Basic
Usage without CSS
Controlled
Controlled vs Uncontrolled
Similar to React's <input /> component, you can either control the state of MapInteraction yourself, or let it handle that for you. It is not recommended, however, that you change this mode of control during the lifecycle of a component. Once you have started controlling the state, keep controlling it under you unmount MapInteraction (likewise with uncontrolled). If you pass value prop, we assume you are controlling the state via a onChange prop.
Click and drag handlers on child elements
This component lets you decide how to respond to click/drag events on the children that you render inside of the map. To know if an element was clicked or dragged, you can attach onClick or onTouchEnd events and then check the e.defaultPrevented attribute. MapInteraction will set defaultPrevented to true if the touchend/mouseup event happened after a drag, and false if it was a click. See index.stories.js for an example.
Prop Types for MapInteractionCSS (all optional)
MapInteraction doesn't require any props. It will control its own internal state, and pass values to its children. If you need to control the scale and translation then you can pass those values as props and listen to the onChange event to receive updates.
Prop Types for MapInteraction (all optional)