2
2
import "./stylesheets/main.css" ;
3
3
import { mix } from "mixwith" ;
4
4
import * as THREE from "three" ;
5
- import { saveImageDataToFile } from "@exabyte-io/cove.js/dist/utils/downloader" ;
6
5
import { ATOM_GROUP_NAME } from "./enums" ;
7
6
import { AtomsMixin } from "./mixins/atoms" ;
8
7
import { BondsMixin } from "./mixins/bonds" ;
@@ -13,8 +12,8 @@ import { ControlsMixin } from "./mixins/controls";
13
12
import { LabelsMixin } from "./mixins/labels" ;
14
13
import { MeasurementMixin } from "./mixins/measurement" ;
15
14
import { RepetitionMixin } from "./mixins/repetition" ;
16
- import { createRotatingGifData } from "./mixins/utils" ;
17
15
import SETTINGS from "./settings" ;
16
+ import { ImageMixin } from "./mixins/image" ;
18
17
// eslint-disable-next-line import/no-cycle
19
18
const TV3 = THREE . Vector3 ;
20
19
const TCo = THREE . Color ;
@@ -195,7 +194,7 @@ class WaveBase {
195
194
/**
196
195
* Wave draws atoms as spheres according to the material geometry passed.
197
196
*/
198
- export class Wave extends mix ( WaveBase ) . with ( AtomsMixin , BondsMixin , CellMixin , RepetitionMixin , ControlsMixin , BoundaryMixin , LabelsMixin , MeasurementMixin ) {
197
+ export class Wave extends mix ( WaveBase ) . with ( AtomsMixin , BondsMixin , CellMixin , RepetitionMixin , ControlsMixin , BoundaryMixin , LabelsMixin , MeasurementMixin , ImageMixin ) {
199
198
/**
200
199
*
201
200
* @param {Object } config
@@ -208,12 +207,6 @@ export class Wave extends mix(WaveBase).with(AtomsMixin, BondsMixin, CellMixin,
208
207
this . render = this . render . bind ( this ) ;
209
208
this . doFunc = this . doFunc . bind ( this ) ;
210
209
}
211
- takeScreenshot ( ) {
212
- saveImageDataToFile ( this . getScreenshotImage ( ) ) ;
213
- }
214
- getScreenshotImage ( ) {
215
- return this . renderer . domElement . toDataURL ( "image/png" ) ;
216
- }
217
210
clearView ( ) {
218
211
while ( this . structureGroup . children . length ) {
219
212
this . structureGroup . remove ( this . structureGroup . children [ 0 ] ) ;
@@ -279,9 +272,4 @@ export class Wave extends mix(WaveBase).with(AtomsMixin, BondsMixin, CellMixin,
279
272
doFunc ( func ) {
280
273
func ( this ) ;
281
274
} // for scripting
282
- async takeGifScreenshot ( options = { } ) {
283
- const gifDataUrl = await createRotatingGifData ( this , options ) ;
284
- const fileName = this . _structure . name || this . _structure . formula || "wave-visualization" + ".gif" ;
285
- saveImageDataToFile ( gifDataUrl , fileName ) ;
286
- }
287
275
}
0 commit comments