Direction judgment using bitwise operation
Like the following, I think it can be better than using string comparison performance.
export enum Direction {
left = 1,
right = 2,
top = 4,
bottom = 8,
topLeft = 5,
topRight = 6,
bottomLeft = 9,
bottomRight = 10,
}
if (Direction.top & direction) {
}
I modified some code in this repository.
It implements the above features.
At the same time avoid some problems. E.g: Improve the cursor mask, full screen display, (correct display cursor). Improve the range of drag and drop, such as the position in the upper right corner.
https://github.com/FishOrBear/ResizableAndDraggable/blob/master/src/resizable/resizer.tsx#L163
hello, how can I get the direction in which it is being resized?
@willianmesko https://github.com/FishOrBear/ResizableAndDraggable/blob/master/src/resizable/resizer.tsx#L203