1.4.5 • Published 11 months ago

@hffxx/react-overflow-box v1.4.5

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

react-overflow-box

React Overflowbox to implement mouse-like dragging.

Demo

Codesandbox demo

Install

npm i @hffxx/react-overflow-box
yarn add @hffxx/react-overflow-box

Usage

import { Overflowbox } from '@hffxx/react-overflow-box';

const Component = () => {
  return (
    <Overflowbox width={500} height={500}>
      <img src={your_src} alt="" />
    </Overflowbox>
  );
};

Component properties

PropTypeDescriptionDefault
widthnumberView width
heightnumberView height
xnumberInitial X-axis view position
ynumberInitial Y-axis view position
setXSetStateActionReact setState for X-axis value
setYSetStateActionReact setState for Y-axis value
wrapperElementTypeWrapper element"div"
reactRefMutableRefObjectRef
childrenReactNodeChildren
showScrollbarBooleanShow the scrollbarsfalse
smoothScrollingBooleanEnables smooth animation for scrollingfalse
classNameStringCustom classname for the wrapper
disableXBooleanDisable X-axis view dragfalse
disableYBooleanDisable Y-axis view dragfalse
disableBooleanDisable X-axis and Y-axis view dragfalse
onDragStartFunctionInvoked when the user starts dragging
onDragEndFunctionInvoked when the user ends dragging
onMoveStartFunctionInvoked when the view position starts changing
onMoveEndFunctionInvoked when the view position stops changing
cursorCursorOverrides default cursor"grab"
grabCursorCursorOverrides default cursor while dragging"grabbing"
disableScrollWheelBooleanDisables scrolling inside wrapperfalse

FAQ

  • How do I position the view in pixels?

    In the Overflowbox component, you pass the x and y as number. If you have an image that is 1000px width, you can set x value as 500 to center the image.

License

The source code is licensed under MIT

1.4.5

11 months ago

1.4.4

11 months ago

1.4.3

12 months ago

1.4.2

12 months ago

1.3.7

1 year ago

1.2.8

1 year ago

1.3.6

1 year ago

1.2.7

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.4.1

1 year ago

1.3.2

1 year ago

1.4.0

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.3.9

1 year ago

1.3.8

1 year ago

1.2.9

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago