@judah-silva/rnacanvas 0.0.4 → 0.0.5
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.
- package/dist/index.js +7 -4
- package/dist/index.mjs +7 -4
- package/package.json +1 -1
- package/judah-silva-rnacanvas-0.0.3.tgz +0 -0
package/dist/index.js
CHANGED
|
@@ -1163,7 +1163,7 @@ function Canvas({
|
|
|
1163
1163
|
const [kabschRMSD, setKabschRMSD] = (0, import_react.useState)([]);
|
|
1164
1164
|
const [lockedMotifIds, setLockedMotifIds] = (0, import_react.useState)([]);
|
|
1165
1165
|
const addMotif = (motif) => {
|
|
1166
|
-
if (
|
|
1166
|
+
if (selectedMotifMeshState.current.has(motif)) {
|
|
1167
1167
|
return;
|
|
1168
1168
|
}
|
|
1169
1169
|
const newSet = /* @__PURE__ */ new Set();
|
|
@@ -1176,12 +1176,13 @@ function Canvas({
|
|
|
1176
1176
|
selectedMotifMeshState.current.add(motif);
|
|
1177
1177
|
};
|
|
1178
1178
|
const removeMotif = (motif) => {
|
|
1179
|
-
if (!
|
|
1179
|
+
if (!selectedMotifMeshState.current.has(motif)) {
|
|
1180
1180
|
return;
|
|
1181
1181
|
}
|
|
1182
|
+
console.log("removing motif: ", motif);
|
|
1182
1183
|
selectedMotifMeshState.current.delete(motif);
|
|
1183
1184
|
setSelectedmotifIds((prevState) => {
|
|
1184
|
-
const newState = prevState;
|
|
1185
|
+
const newState = new Set(prevState);
|
|
1185
1186
|
newState.delete(motif.uuid);
|
|
1186
1187
|
return newState;
|
|
1187
1188
|
});
|
|
@@ -1317,13 +1318,15 @@ function Canvas({
|
|
|
1317
1318
|
if (!event.rotationAxis.equals(Vec3.Zero) || !event.translationDirection.equals(Vec3.Zero)) {
|
|
1318
1319
|
return;
|
|
1319
1320
|
}
|
|
1320
|
-
if (!/^[
|
|
1321
|
+
if (!/^[1-9]$/.test(event.key) || Number(event.key) > motifs.length) {
|
|
1321
1322
|
return;
|
|
1322
1323
|
}
|
|
1323
1324
|
const motif = motifs[Number(event.key) - 1];
|
|
1324
1325
|
if (selectedMotifMeshState.current.has(motif)) {
|
|
1326
|
+
console.log("removing motif");
|
|
1325
1327
|
removeMotif(motif);
|
|
1326
1328
|
} else {
|
|
1329
|
+
console.log("adding motif");
|
|
1327
1330
|
addMotif(motif);
|
|
1328
1331
|
}
|
|
1329
1332
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1106,7 +1106,7 @@ function Canvas({
|
|
|
1106
1106
|
const [kabschRMSD, setKabschRMSD] = useState([]);
|
|
1107
1107
|
const [lockedMotifIds, setLockedMotifIds] = useState([]);
|
|
1108
1108
|
const addMotif = (motif) => {
|
|
1109
|
-
if (
|
|
1109
|
+
if (selectedMotifMeshState.current.has(motif)) {
|
|
1110
1110
|
return;
|
|
1111
1111
|
}
|
|
1112
1112
|
const newSet = /* @__PURE__ */ new Set();
|
|
@@ -1119,12 +1119,13 @@ function Canvas({
|
|
|
1119
1119
|
selectedMotifMeshState.current.add(motif);
|
|
1120
1120
|
};
|
|
1121
1121
|
const removeMotif = (motif) => {
|
|
1122
|
-
if (!
|
|
1122
|
+
if (!selectedMotifMeshState.current.has(motif)) {
|
|
1123
1123
|
return;
|
|
1124
1124
|
}
|
|
1125
|
+
console.log("removing motif: ", motif);
|
|
1125
1126
|
selectedMotifMeshState.current.delete(motif);
|
|
1126
1127
|
setSelectedmotifIds((prevState) => {
|
|
1127
|
-
const newState = prevState;
|
|
1128
|
+
const newState = new Set(prevState);
|
|
1128
1129
|
newState.delete(motif.uuid);
|
|
1129
1130
|
return newState;
|
|
1130
1131
|
});
|
|
@@ -1260,13 +1261,15 @@ function Canvas({
|
|
|
1260
1261
|
if (!event.rotationAxis.equals(Vec3.Zero) || !event.translationDirection.equals(Vec3.Zero)) {
|
|
1261
1262
|
return;
|
|
1262
1263
|
}
|
|
1263
|
-
if (!/^[
|
|
1264
|
+
if (!/^[1-9]$/.test(event.key) || Number(event.key) > motifs.length) {
|
|
1264
1265
|
return;
|
|
1265
1266
|
}
|
|
1266
1267
|
const motif = motifs[Number(event.key) - 1];
|
|
1267
1268
|
if (selectedMotifMeshState.current.has(motif)) {
|
|
1269
|
+
console.log("removing motif");
|
|
1268
1270
|
removeMotif(motif);
|
|
1269
1271
|
} else {
|
|
1272
|
+
console.log("adding motif");
|
|
1270
1273
|
addMotif(motif);
|
|
1271
1274
|
}
|
|
1272
1275
|
}
|
package/package.json
CHANGED
|
Binary file
|