react-konva-grid
Advanced tools
Comparing version 2.8.7 to 2.8.8
@@ -141,6 +141,12 @@ "use strict"; | ||
/* Exit early if grid is not initialized */ | ||
if (!gridRef || | ||
!gridRef.current || | ||
e.nativeEvent.which === types_1.MouseButtonCodes.right) | ||
if (!gridRef || !gridRef.current) | ||
return; | ||
const coords = gridRef.current.getCellCoordsFromOffset(e.clientX, e.clientY); | ||
/* Check if its context menu click */ | ||
const isContextMenuClick = e.nativeEvent.which === types_1.MouseButtonCodes.right; | ||
if (isContextMenuClick) { | ||
const cellIndex = cellIndexInSelection(coords, selections); | ||
if (cellIndex !== -1) | ||
return; | ||
} | ||
const isShiftKey = e.nativeEvent.shiftKey; | ||
@@ -153,12 +159,9 @@ const isMetaKey = e.nativeEvent.ctrlKey || e.nativeEvent.metaKey; | ||
/* Attaching mousemove to document, so we can detect drag move */ | ||
document.addEventListener("mousemove", handleMouseMove); | ||
if (!isContextMenuClick) { | ||
/* Prevent mousemove if its contextmenu click */ | ||
document.addEventListener("mousemove", handleMouseMove); | ||
} | ||
document.addEventListener("mouseup", handleMouseUp); | ||
/* Activate selection mode */ | ||
isSelecting.current = true; | ||
const { rowIndex, columnIndex } = gridRef.current.getCellCoordsFromOffset(e.clientX, e.clientY); | ||
/** | ||
* Save the initial Selection in ref | ||
* so we can adjust the bounds in mousemove | ||
*/ | ||
const coords = { rowIndex, columnIndex }; | ||
/* Shift key */ | ||
@@ -165,0 +168,0 @@ if (isShiftKey) { |
{ | ||
"name": "react-konva-grid", | ||
"description": "Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets", | ||
"version": "2.8.7", | ||
"version": "2.8.8", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -251,8 +251,13 @@ import React, { useState, useCallback, useRef, useEffect } from "react"; | ||
/* Exit early if grid is not initialized */ | ||
if ( | ||
!gridRef || | ||
!gridRef.current || | ||
e.nativeEvent.which === MouseButtonCodes.right | ||
) | ||
return; | ||
if (!gridRef || !gridRef.current) return; | ||
const coords = gridRef.current.getCellCoordsFromOffset( | ||
e.clientX, | ||
e.clientY | ||
); | ||
/* Check if its context menu click */ | ||
const isContextMenuClick = e.nativeEvent.which === MouseButtonCodes.right; | ||
if (isContextMenuClick) { | ||
const cellIndex = cellIndexInSelection(coords, selections); | ||
if (cellIndex !== -1) return; | ||
} | ||
const isShiftKey = e.nativeEvent.shiftKey; | ||
@@ -267,3 +272,6 @@ const isMetaKey = e.nativeEvent.ctrlKey || e.nativeEvent.metaKey; | ||
/* Attaching mousemove to document, so we can detect drag move */ | ||
document.addEventListener("mousemove", handleMouseMove); | ||
if (!isContextMenuClick) { | ||
/* Prevent mousemove if its contextmenu click */ | ||
document.addEventListener("mousemove", handleMouseMove); | ||
} | ||
document.addEventListener("mouseup", handleMouseUp); | ||
@@ -274,13 +282,2 @@ | ||
const { rowIndex, columnIndex } = gridRef.current.getCellCoordsFromOffset( | ||
e.clientX, | ||
e.clientY | ||
); | ||
/** | ||
* Save the initial Selection in ref | ||
* so we can adjust the bounds in mousemove | ||
*/ | ||
const coords = { rowIndex, columnIndex }; | ||
/* Shift key */ | ||
@@ -287,0 +284,0 @@ if (isShiftKey) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
364784
7938