@judah-silva/rnacanvas 0.0.2 → 0.0.3
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.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +32 -4
- package/dist/index.mjs +32 -4
- package/package.json +1 -1
- package/judah-silva-rnacanvas-0.0.1.tgz +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -60,10 +60,16 @@ declare class Quat {
|
|
|
60
60
|
private _quaternion;
|
|
61
61
|
constructor();
|
|
62
62
|
rotateByQuaternion(quaternion: Quat): void;
|
|
63
|
-
setToQuaternion(quaternion: Nullable<Quaternion>):
|
|
63
|
+
setToQuaternion(quaternion: Nullable<Quaternion>): this;
|
|
64
64
|
setFromMatrix(matrix: Matrix4): this;
|
|
65
65
|
setFromEuler(eulerAngle: Vec3): this;
|
|
66
|
+
setFromValues(w: number, x: number, y: number, z: number): this;
|
|
67
|
+
toArray(): number[];
|
|
66
68
|
get quaternion(): Quaternion;
|
|
69
|
+
get w(): number;
|
|
70
|
+
get x(): number;
|
|
71
|
+
get y(): number;
|
|
72
|
+
get z(): number;
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
declare class Vec3 {
|
|
@@ -110,6 +116,7 @@ declare class Motif extends Group<Residue> {
|
|
|
110
116
|
private _nanCheck;
|
|
111
117
|
get uuid(): string;
|
|
112
118
|
get quat(): Quat;
|
|
119
|
+
get scale(): number;
|
|
113
120
|
get position(): Vec3;
|
|
114
121
|
}
|
|
115
122
|
|
|
@@ -383,6 +390,7 @@ interface MotifProps {
|
|
|
383
390
|
locked: boolean;
|
|
384
391
|
position?: Vec3;
|
|
385
392
|
rotation?: Quat;
|
|
393
|
+
scale?: number;
|
|
386
394
|
}
|
|
387
395
|
/**
|
|
388
396
|
* ________________________________________________________________________________________________
|
package/dist/index.d.ts
CHANGED
|
@@ -60,10 +60,16 @@ declare class Quat {
|
|
|
60
60
|
private _quaternion;
|
|
61
61
|
constructor();
|
|
62
62
|
rotateByQuaternion(quaternion: Quat): void;
|
|
63
|
-
setToQuaternion(quaternion: Nullable<Quaternion>):
|
|
63
|
+
setToQuaternion(quaternion: Nullable<Quaternion>): this;
|
|
64
64
|
setFromMatrix(matrix: Matrix4): this;
|
|
65
65
|
setFromEuler(eulerAngle: Vec3): this;
|
|
66
|
+
setFromValues(w: number, x: number, y: number, z: number): this;
|
|
67
|
+
toArray(): number[];
|
|
66
68
|
get quaternion(): Quaternion;
|
|
69
|
+
get w(): number;
|
|
70
|
+
get x(): number;
|
|
71
|
+
get y(): number;
|
|
72
|
+
get z(): number;
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
declare class Vec3 {
|
|
@@ -110,6 +116,7 @@ declare class Motif extends Group<Residue> {
|
|
|
110
116
|
private _nanCheck;
|
|
111
117
|
get uuid(): string;
|
|
112
118
|
get quat(): Quat;
|
|
119
|
+
get scale(): number;
|
|
113
120
|
get position(): Vec3;
|
|
114
121
|
}
|
|
115
122
|
|
|
@@ -383,6 +390,7 @@ interface MotifProps {
|
|
|
383
390
|
locked: boolean;
|
|
384
391
|
position?: Vec3;
|
|
385
392
|
rotation?: Quat;
|
|
393
|
+
scale?: number;
|
|
386
394
|
}
|
|
387
395
|
/**
|
|
388
396
|
* ________________________________________________________________________________________________
|
package/dist/index.js
CHANGED
|
@@ -145,7 +145,8 @@ var Quat = class {
|
|
|
145
145
|
if (quaternion === null) {
|
|
146
146
|
throw new Error("Cannot set to null quaternion");
|
|
147
147
|
}
|
|
148
|
-
this.
|
|
148
|
+
this.setFromValues(quaternion.w, quaternion.x, quaternion.y, quaternion.z);
|
|
149
|
+
return this;
|
|
149
150
|
}
|
|
150
151
|
setFromMatrix(matrix) {
|
|
151
152
|
this._quaternion = import_core3.Quaternion.FromRotationMatrix(matrix.matrix);
|
|
@@ -155,9 +156,30 @@ var Quat = class {
|
|
|
155
156
|
this._quaternion = import_core3.Quaternion.FromEulerAngles(eulerAngle.x, eulerAngle.y, eulerAngle.z);
|
|
156
157
|
return this;
|
|
157
158
|
}
|
|
159
|
+
setFromValues(w, x, y, z) {
|
|
160
|
+
this._quaternion.set(x, y, z, w);
|
|
161
|
+
return this;
|
|
162
|
+
}
|
|
163
|
+
toArray() {
|
|
164
|
+
const quatArr = [];
|
|
165
|
+
this._quaternion.toArray(quatArr);
|
|
166
|
+
return quatArr;
|
|
167
|
+
}
|
|
158
168
|
get quaternion() {
|
|
159
169
|
return this._quaternion;
|
|
160
170
|
}
|
|
171
|
+
get w() {
|
|
172
|
+
return this._quaternion.w;
|
|
173
|
+
}
|
|
174
|
+
get x() {
|
|
175
|
+
return this._quaternion.x;
|
|
176
|
+
}
|
|
177
|
+
get y() {
|
|
178
|
+
return this._quaternion.y;
|
|
179
|
+
}
|
|
180
|
+
get z() {
|
|
181
|
+
return this._quaternion.z;
|
|
182
|
+
}
|
|
161
183
|
};
|
|
162
184
|
|
|
163
185
|
// src/Math/Matrix4.ts
|
|
@@ -261,9 +283,15 @@ var Motif = class extends Group {
|
|
|
261
283
|
return this._node.uniqueId.toString();
|
|
262
284
|
}
|
|
263
285
|
get quat() {
|
|
286
|
+
if (this._node.rotationQuaternion === null) {
|
|
287
|
+
this._node.rotationQuaternion = this._node.rotation.toQuaternion();
|
|
288
|
+
}
|
|
264
289
|
this._quat.setToQuaternion(this._node.rotationQuaternion);
|
|
265
290
|
return this._quat;
|
|
266
291
|
}
|
|
292
|
+
get scale() {
|
|
293
|
+
return this._node.scaling.x;
|
|
294
|
+
}
|
|
267
295
|
get position() {
|
|
268
296
|
return new Vec3(
|
|
269
297
|
this._node.absolutePosition.x,
|
|
@@ -1405,11 +1433,11 @@ function Canvas({
|
|
|
1405
1433
|
});
|
|
1406
1434
|
if (scene.current.children.size !== motifs.length) {
|
|
1407
1435
|
motifs.forEach((motifMesh, index) => {
|
|
1408
|
-
|
|
1436
|
+
scene.current?.add(motifMesh);
|
|
1437
|
+
if (motifProps[index].position) positions[index] = motifProps[index].position.clone();
|
|
1409
1438
|
motifMesh.setPosition(positions[index].x, positions[index].y, positions[index].z);
|
|
1410
|
-
if (motifProps[index].rotation) motifMesh.
|
|
1439
|
+
if (motifProps[index].rotation) motifMesh.quat.setToQuaternion(motifProps[index].rotation.quaternion);
|
|
1411
1440
|
motifMesh.multiplyScalar(canvasRef.current.width / 250);
|
|
1412
|
-
scene.current?.add(motifMesh);
|
|
1413
1441
|
});
|
|
1414
1442
|
const eventManager = scene.current?.eventManager;
|
|
1415
1443
|
eventManager.on(Events.EventType.OBJECT_SELECTED, onSelectMotif);
|
package/dist/index.mjs
CHANGED
|
@@ -88,7 +88,8 @@ var Quat = class {
|
|
|
88
88
|
if (quaternion === null) {
|
|
89
89
|
throw new Error("Cannot set to null quaternion");
|
|
90
90
|
}
|
|
91
|
-
this.
|
|
91
|
+
this.setFromValues(quaternion.w, quaternion.x, quaternion.y, quaternion.z);
|
|
92
|
+
return this;
|
|
92
93
|
}
|
|
93
94
|
setFromMatrix(matrix) {
|
|
94
95
|
this._quaternion = Quaternion2.FromRotationMatrix(matrix.matrix);
|
|
@@ -98,9 +99,30 @@ var Quat = class {
|
|
|
98
99
|
this._quaternion = Quaternion2.FromEulerAngles(eulerAngle.x, eulerAngle.y, eulerAngle.z);
|
|
99
100
|
return this;
|
|
100
101
|
}
|
|
102
|
+
setFromValues(w, x, y, z) {
|
|
103
|
+
this._quaternion.set(x, y, z, w);
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
106
|
+
toArray() {
|
|
107
|
+
const quatArr = [];
|
|
108
|
+
this._quaternion.toArray(quatArr);
|
|
109
|
+
return quatArr;
|
|
110
|
+
}
|
|
101
111
|
get quaternion() {
|
|
102
112
|
return this._quaternion;
|
|
103
113
|
}
|
|
114
|
+
get w() {
|
|
115
|
+
return this._quaternion.w;
|
|
116
|
+
}
|
|
117
|
+
get x() {
|
|
118
|
+
return this._quaternion.x;
|
|
119
|
+
}
|
|
120
|
+
get y() {
|
|
121
|
+
return this._quaternion.y;
|
|
122
|
+
}
|
|
123
|
+
get z() {
|
|
124
|
+
return this._quaternion.z;
|
|
125
|
+
}
|
|
104
126
|
};
|
|
105
127
|
|
|
106
128
|
// src/Math/Matrix4.ts
|
|
@@ -204,9 +226,15 @@ var Motif = class extends Group {
|
|
|
204
226
|
return this._node.uniqueId.toString();
|
|
205
227
|
}
|
|
206
228
|
get quat() {
|
|
229
|
+
if (this._node.rotationQuaternion === null) {
|
|
230
|
+
this._node.rotationQuaternion = this._node.rotation.toQuaternion();
|
|
231
|
+
}
|
|
207
232
|
this._quat.setToQuaternion(this._node.rotationQuaternion);
|
|
208
233
|
return this._quat;
|
|
209
234
|
}
|
|
235
|
+
get scale() {
|
|
236
|
+
return this._node.scaling.x;
|
|
237
|
+
}
|
|
210
238
|
get position() {
|
|
211
239
|
return new Vec3(
|
|
212
240
|
this._node.absolutePosition.x,
|
|
@@ -1348,11 +1376,11 @@ function Canvas({
|
|
|
1348
1376
|
});
|
|
1349
1377
|
if (scene.current.children.size !== motifs.length) {
|
|
1350
1378
|
motifs.forEach((motifMesh, index) => {
|
|
1351
|
-
|
|
1379
|
+
scene.current?.add(motifMesh);
|
|
1380
|
+
if (motifProps[index].position) positions[index] = motifProps[index].position.clone();
|
|
1352
1381
|
motifMesh.setPosition(positions[index].x, positions[index].y, positions[index].z);
|
|
1353
|
-
if (motifProps[index].rotation) motifMesh.
|
|
1382
|
+
if (motifProps[index].rotation) motifMesh.quat.setToQuaternion(motifProps[index].rotation.quaternion);
|
|
1354
1383
|
motifMesh.multiplyScalar(canvasRef.current.width / 250);
|
|
1355
|
-
scene.current?.add(motifMesh);
|
|
1356
1384
|
});
|
|
1357
1385
|
const eventManager = scene.current?.eventManager;
|
|
1358
1386
|
eventManager.on(Events.EventType.OBJECT_SELECTED, onSelectMotif);
|
package/package.json
CHANGED
|
Binary file
|