@rnacanvas/app-object 17.19.0 → 17.20.0
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/README.md +42 -0
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -166,6 +166,48 @@ The `selectAll` method can also be used to select all elements in the drawing of
|
|
|
166
166
|
app.selectAll();
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
+
### `selectedTertiaryBonds()`
|
|
170
|
+
|
|
171
|
+
Represents the currently selected tertiary bonds.
|
|
172
|
+
|
|
173
|
+
```javascript
|
|
174
|
+
// add some bases to the drawing to start with
|
|
175
|
+
var bases = [...'AUGCAUGC'].map(letter => app.drawing.addBase(letter));
|
|
176
|
+
|
|
177
|
+
// add some tertiary bonds
|
|
178
|
+
var tbs = [[0, 6], [1, 7]].map(([i, j]) => (
|
|
179
|
+
app.drawing.addTertiaryBond(bases[i], bases[j])
|
|
180
|
+
));
|
|
181
|
+
|
|
182
|
+
app.select(tbs);
|
|
183
|
+
|
|
184
|
+
[...app.selectedTertiaryBonds].length; // 2
|
|
185
|
+
|
|
186
|
+
[...app.selectedTertiaryBonds].include(tbs[0]); // true
|
|
187
|
+
[...app.selectedTertiaryBonds].include(tbs[1]); // true
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Changes to the currently selected tertiary bonds can also be listened for.
|
|
191
|
+
|
|
192
|
+
```javascript
|
|
193
|
+
var count = 0;
|
|
194
|
+
|
|
195
|
+
var listener = () => count += 1;
|
|
196
|
+
|
|
197
|
+
app.selectedTertiaryBonds.addEventListener('change', listener);
|
|
198
|
+
|
|
199
|
+
app.removeFromSelected([tbs[0]]);
|
|
200
|
+
|
|
201
|
+
count; // 1
|
|
202
|
+
|
|
203
|
+
app.selectedTertiaryBonds.removeEventListener('change', listener);
|
|
204
|
+
|
|
205
|
+
app.addToSelected([tbs[0]]);
|
|
206
|
+
|
|
207
|
+
// not incremented
|
|
208
|
+
count; // 1
|
|
209
|
+
```
|
|
210
|
+
|
|
169
211
|
### Opening forms
|
|
170
212
|
|
|
171
213
|
Forms can be opened using the `openForm` method.
|