seat-editor 3.6.16 → 3.6.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,7 +9,7 @@ import { selection } from "./selection";
|
|
|
9
9
|
export default function GraphView() {
|
|
10
10
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
11
11
|
const [actionPrivileged, setActionPrivileged] = useState({
|
|
12
|
-
select:
|
|
12
|
+
select: false,
|
|
13
13
|
move: false,
|
|
14
14
|
switch: false,
|
|
15
15
|
drop: false,
|
|
@@ -8,7 +8,7 @@ import { selection } from "./selection";
|
|
|
8
8
|
export default function GraphView() {
|
|
9
9
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
10
10
|
const [actionPrivileged, setActionPrivileged] = useState({
|
|
11
|
-
select:
|
|
11
|
+
select: false,
|
|
12
12
|
move: false,
|
|
13
13
|
switch: false,
|
|
14
14
|
drop: false,
|
|
@@ -262,6 +262,7 @@ const LayerView = (props) => {
|
|
|
262
262
|
}, [actionPrivileged]);
|
|
263
263
|
const handlePointerDown = (e) => {
|
|
264
264
|
var _a, _b, _c;
|
|
265
|
+
console.log("handlePointerDown");
|
|
265
266
|
const svg = svgRef.current;
|
|
266
267
|
if (!e.isPrimary || !svg)
|
|
267
268
|
return;
|
|
@@ -274,7 +275,7 @@ const LayerView = (props) => {
|
|
|
274
275
|
const { clientX, clientY } = e;
|
|
275
276
|
const hitPoint = document.elementFromPoint(clientX, clientY);
|
|
276
277
|
const downOutTable = (hitPoint === null || hitPoint === void 0 ? void 0 : hitPoint.nodeName) === "svg";
|
|
277
|
-
const makeSelection = downOutTable && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.selection);
|
|
278
|
+
const makeSelection = (downOutTable || !(hitPoint === null || hitPoint === void 0 ? void 0 : hitPoint.closest("g[data-id]"))) && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.selection);
|
|
278
279
|
const hadSelection = dataElementSelectionGroupRef.current.length > 0;
|
|
279
280
|
const downInOutSelection = hadSelection && makeSelection;
|
|
280
281
|
if (downOutTable) {
|
|
@@ -298,12 +299,12 @@ const LayerView = (props) => {
|
|
|
298
299
|
handleUnSelectComponent();
|
|
299
300
|
}
|
|
300
301
|
setPanningGroup(true);
|
|
301
|
-
if (!targetGroup) {
|
|
302
|
+
if (!targetGroup && (props === null || props === void 0 ? void 0 : props.allowTooltip)) {
|
|
302
303
|
setTooltip((prev) => (Object.assign(Object.assign({}, prev), { visible: false })));
|
|
303
304
|
return;
|
|
304
305
|
}
|
|
305
|
-
let ghost = targetGroup.cloneNode(true);
|
|
306
|
-
const ghostId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
306
|
+
let ghost = targetGroup === null || targetGroup === void 0 ? void 0 : targetGroup.cloneNode(true);
|
|
307
|
+
const ghostId = JSON.parse((targetGroup === null || targetGroup === void 0 ? void 0 : targetGroup.getAttribute("data-id")) || "{}");
|
|
307
308
|
const allowedDrag = (!(props === null || props === void 0 ? void 0 : props.dragTableBlockKey)
|
|
308
309
|
? true
|
|
309
310
|
: !((_b = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _b === void 0 ? void 0 : _b.some((_) => {
|
|
@@ -319,14 +320,16 @@ const LayerView = (props) => {
|
|
|
319
320
|
const dataRaw = originalData({ id: ghostId, type: "find" });
|
|
320
321
|
(actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.dragTable) && (props === null || props === void 0 ? void 0 : props.onDragTable) && props.onDragTable(e, dataRaw);
|
|
321
322
|
}
|
|
322
|
-
ghost.setAttribute("opacity", "0.5");
|
|
323
|
-
ghost.setAttribute("pointer-events", "none");
|
|
324
|
-
ghost.setAttribute("stroke-width", "1");
|
|
325
|
-
|
|
326
|
-
|
|
323
|
+
ghost === null || ghost === void 0 ? void 0 : ghost.setAttribute("opacity", "0.5");
|
|
324
|
+
ghost === null || ghost === void 0 ? void 0 : ghost.setAttribute("pointer-events", "none");
|
|
325
|
+
ghost === null || ghost === void 0 ? void 0 : ghost.setAttribute("stroke-width", "1");
|
|
326
|
+
if (ghost) {
|
|
327
|
+
svg.appendChild(ghost);
|
|
328
|
+
tableGhost.current = ghost;
|
|
329
|
+
}
|
|
327
330
|
const startBox = getTranslate(targetGroup);
|
|
328
|
-
const groupCTM = targetGroup.getCTM();
|
|
329
|
-
if (!groupCTM) {
|
|
331
|
+
const groupCTM = targetGroup === null || targetGroup === void 0 ? void 0 : targetGroup.getCTM();
|
|
332
|
+
if (!groupCTM && targetGroup) {
|
|
330
333
|
setTooltip((prev) => (Object.assign(Object.assign({}, prev), { visible: false })));
|
|
331
334
|
return;
|
|
332
335
|
}
|
|
@@ -261,6 +261,7 @@ const LayerView = (props) => {
|
|
|
261
261
|
}, [actionPrivileged]);
|
|
262
262
|
const handlePointerDown = (e) => {
|
|
263
263
|
var _a, _b, _c;
|
|
264
|
+
console.log("handlePointerDown");
|
|
264
265
|
const svg = svgRef.current;
|
|
265
266
|
if (!e.isPrimary || !svg)
|
|
266
267
|
return;
|
|
@@ -273,7 +274,7 @@ const LayerView = (props) => {
|
|
|
273
274
|
const { clientX, clientY } = e;
|
|
274
275
|
const hitPoint = document.elementFromPoint(clientX, clientY);
|
|
275
276
|
const downOutTable = (hitPoint === null || hitPoint === void 0 ? void 0 : hitPoint.nodeName) === "svg";
|
|
276
|
-
const makeSelection = downOutTable && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.selection);
|
|
277
|
+
const makeSelection = (downOutTable || !(hitPoint === null || hitPoint === void 0 ? void 0 : hitPoint.closest("g[data-id]"))) && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.selection);
|
|
277
278
|
const hadSelection = dataElementSelectionGroupRef.current.length > 0;
|
|
278
279
|
const downInOutSelection = hadSelection && makeSelection;
|
|
279
280
|
if (downOutTable) {
|
|
@@ -297,12 +298,12 @@ const LayerView = (props) => {
|
|
|
297
298
|
handleUnSelectComponent();
|
|
298
299
|
}
|
|
299
300
|
setPanningGroup(true);
|
|
300
|
-
if (!targetGroup) {
|
|
301
|
+
if (!targetGroup && (props === null || props === void 0 ? void 0 : props.allowTooltip)) {
|
|
301
302
|
setTooltip((prev) => (Object.assign(Object.assign({}, prev), { visible: false })));
|
|
302
303
|
return;
|
|
303
304
|
}
|
|
304
|
-
let ghost = targetGroup.cloneNode(true);
|
|
305
|
-
const ghostId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
|
|
305
|
+
let ghost = targetGroup === null || targetGroup === void 0 ? void 0 : targetGroup.cloneNode(true);
|
|
306
|
+
const ghostId = JSON.parse((targetGroup === null || targetGroup === void 0 ? void 0 : targetGroup.getAttribute("data-id")) || "{}");
|
|
306
307
|
const allowedDrag = (!(props === null || props === void 0 ? void 0 : props.dragTableBlockKey)
|
|
307
308
|
? true
|
|
308
309
|
: !((_b = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _b === void 0 ? void 0 : _b.some((_) => {
|
|
@@ -318,14 +319,16 @@ const LayerView = (props) => {
|
|
|
318
319
|
const dataRaw = originalData({ id: ghostId, type: "find" });
|
|
319
320
|
(actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.dragTable) && (props === null || props === void 0 ? void 0 : props.onDragTable) && props.onDragTable(e, dataRaw);
|
|
320
321
|
}
|
|
321
|
-
ghost.setAttribute("opacity", "0.5");
|
|
322
|
-
ghost.setAttribute("pointer-events", "none");
|
|
323
|
-
ghost.setAttribute("stroke-width", "1");
|
|
324
|
-
|
|
325
|
-
|
|
322
|
+
ghost === null || ghost === void 0 ? void 0 : ghost.setAttribute("opacity", "0.5");
|
|
323
|
+
ghost === null || ghost === void 0 ? void 0 : ghost.setAttribute("pointer-events", "none");
|
|
324
|
+
ghost === null || ghost === void 0 ? void 0 : ghost.setAttribute("stroke-width", "1");
|
|
325
|
+
if (ghost) {
|
|
326
|
+
svg.appendChild(ghost);
|
|
327
|
+
tableGhost.current = ghost;
|
|
328
|
+
}
|
|
326
329
|
const startBox = getTranslate(targetGroup);
|
|
327
|
-
const groupCTM = targetGroup.getCTM();
|
|
328
|
-
if (!groupCTM) {
|
|
330
|
+
const groupCTM = targetGroup === null || targetGroup === void 0 ? void 0 : targetGroup.getCTM();
|
|
331
|
+
if (!groupCTM && targetGroup) {
|
|
329
332
|
setTooltip((prev) => (Object.assign(Object.assign({}, prev), { visible: false })));
|
|
330
333
|
return;
|
|
331
334
|
}
|