Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit 98c4377

Browse files
committed
Merge branch 'release/v0.1.4'
2 parents 63124a7 + 664b26d commit 98c4377

17 files changed

+163
-100
lines changed

app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
__major_version__ = '0'
3535
__minor_version__ = '1'
36-
__change_version__ = '3'
36+
__change_version__ = '4'
3737
__version__ = '.'.join(
3838
(__major_version__,
3939
__minor_version__,

dist/colour-analysis.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "colour-analysis",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"description": "Colour - Analysis",
55
"private": true,
66
"scripts": {
@@ -21,5 +21,8 @@
2121
"devDependencies": {
2222
"webpack": "^4.16.5",
2323
"webpack-cli": "^3.1.0"
24+
},
25+
"dependencies": {
26+
"deepmerge": "^2.1.1"
2427
}
2528
}

src/views/gamut-view.js

Lines changed: 58 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import merge from 'deepmerge';
12
import { PerspectiveView } from './perspective-view.js';
23
import { ViewAxesVisual } from '../visuals/view-axes-visual.js';
34
import { ColourspaceVisual } from '../visuals/colourspace-visual.js';
@@ -14,18 +15,18 @@ class GamutView extends PerspectiveView {
1415
constructor(container, settings) {
1516
super(container, settings);
1617

17-
settings = {
18-
...{
18+
settings = merge(
19+
{
1920
scene: {
20-
background: new THREE.Color('#333333')
21+
background: '#333333'
2122
},
2223
fog: {
2324
enable: true,
2425
color: '#333333',
2526
density: 0.05
2627
},
27-
camera: { position: new THREE.Vector3(-3, 3, 3) },
28-
controls: { target: new THREE.Vector3(1 / 3, 0.5, 1 / 3) },
28+
camera: { position: { x: -3, y: 3, z: 3 } },
29+
controls: { target: { x: 1 / 3, y: 0.5, z: 1 / 3 } },
2930
grid: {
3031
enable: true,
3132
size: 2,
@@ -41,21 +42,31 @@ class GamutView extends PerspectiveView {
4142
imageDecodingCctf: 'sRGB',
4243
colourspaceModel: 'CIE xyY'
4344
},
44-
...settings
45-
};
45+
settings || {}
46+
);
4647

4748
this.renderer.sortObjects = false;
4849

49-
this.scene.background = settings.scene.background;
50+
this.scene.background = new THREE.Color(settings.scene.background);
5051
if (settings.fog.enable) {
5152
this.scene.fog = new THREE.FogExp2(
5253
settings.fog.color,
5354
settings.fog.density
5455
);
5556
}
5657

57-
this.camera.position.copy(settings.camera.position);
58-
this.controls.target = settings.controls.target;
58+
this.camera.position.copy(
59+
new THREE.Vector3(
60+
settings.camera.position.x,
61+
settings.camera.position.y,
62+
settings.camera.position.z
63+
)
64+
);
65+
this.controls.target = new THREE.Vector3(
66+
settings.controls.target.x,
67+
settings.controls.target.y,
68+
settings.controls.target.z
69+
);
5970

6071
if (settings.grid.enable) {
6172
this.grid = new THREE.GridHelper(
@@ -329,110 +340,113 @@ class GamutView extends PerspectiveView {
329340
}
330341

331342
addViewAxesVisual(settings) {
332-
this._viewAxesVisual = new ViewAxesVisual(this, {
333-
...{
334-
colourspaceModel: this._colourspaceModel
335-
},
336-
...settings
337-
});
343+
this._viewAxesVisual = new ViewAxesVisual(
344+
this,
345+
merge(
346+
{
347+
colourspaceModel: this._colourspaceModel
348+
},
349+
settings || {}
350+
)
351+
);
338352
this._viewAxesVisual.add();
339353
}
340354

341355
addVisibleSpectrumVisual(settings) {
342356
this._visibleSpectrumVisual = new VisibleSpectrumVisual(
343357
this._visibleSpectrumVisualGroup,
344-
{
345-
...{
358+
merge(
359+
{
346360
colourspaceModel: this._colourspaceModel
347361
},
348-
...settings
349-
}
362+
settings || {}
363+
)
350364
);
351365
this._visibleSpectrumVisual.add();
352366
}
353367

354368
addSpectralLocusVisual(settings) {
355369
this._spectralLocusVisual = new SpectralLocusVisual(
356370
this._spectralLocusVisualGroup,
357-
{
358-
...{
371+
merge(
372+
{
359373
colourspace: this._secondaryColourspace,
360374
colourspaceModel: this._colourspaceModel
361375
},
362-
...settings
363-
}
376+
settings || {}
377+
)
364378
);
365379
this._spectralLocusVisual.add();
366380
}
367381

368382
addPointerGamutVisual(settings) {
369383
this._pointerGamutVisual = new PointerGamutVisual(
370384
this._pointerGamutVisualGroup,
371-
{
372-
...{
385+
merge(
386+
{
373387
colourspaceModel: this._colourspaceModel
374388
},
375-
...settings
376-
}
389+
settings || {}
390+
)
377391
);
378392
this._pointerGamutVisual.add();
379393
}
380394

381395
addSecondaryColourspaceVisual(settings) {
382396
this._secondaryColourspaceVisual = new ColourspaceVisual(
383397
this._secondaryColourspaceVisualGroup,
384-
{
385-
...{
398+
merge(
399+
{
386400
name: 'secondary-colourspace-visual',
387401
colourspace: this._secondaryColourspace,
388402
colourspaceModel: this._colourspaceModel,
389403
wireframe: true,
390404
uniformOpacity: 0.25
391405
},
392-
...settings
393-
}
406+
settings || {}
407+
)
394408
);
395409
this._secondaryColourspaceVisual.add();
396410
}
397411

398412
addPrimaryColourspaceVisual(settings) {
399413
this._primaryColourspaceVisual = new ColourspaceVisual(
400414
this._primaryColourspaceVisualGroup,
401-
{
402-
...{
415+
merge(
416+
{
403417
name: 'primary-colourspace-visual',
404418
colourspace: this._primaryColourspace,
405419
colourspaceModel: this._colourspaceModel
406420
},
407-
...settings
408-
}
421+
settings || {}
422+
)
409423
);
410424
this._primaryColourspaceVisual.add();
411425
}
412426

413427
addImageScatterVisual(settings) {
414428
this._imageScatterVisual = new ImageScatterVisual(
415429
this._imageScatterVisualGroup,
416-
{
417-
...{
430+
merge(
431+
{
418432
image: this._image,
419433
primaryColourspace: this._primaryColourspace,
420434
secondaryColourspace: this._secondaryColourspace,
421435
imageColourspace: this._imageColourspace,
422436
imageDecodingCctf: this._imageDecodingCctf,
423437
colourspaceModel: this._colourspaceModel
424438
},
425-
...settings
426-
}
439+
settings || {}
440+
)
427441
);
428442
this._imageScatterVisual.add();
429443
}
430444

431445
addImageScatterOverlayVisual(settings) {
432446
this._imageScatterOverlayVisual = new ImageScatterVisual(
433447
this._imageScatterOverlayVisualGroup,
434-
{
435-
...{
448+
merge(
449+
{
436450
name: 'image-scatter-overlay-visual',
437451
image: this._image,
438452
primaryColourspace: this._primaryColourspace,
@@ -442,8 +456,8 @@ class GamutView extends PerspectiveView {
442456
colourspaceModel: this._colourspaceModel,
443457
uniformOpacity: 0.5
444458
},
445-
...settings
446-
}
459+
settings || {}
460+
)
447461
);
448462
this._imageScatterOverlayVisual.add();
449463
}

src/views/image-view.js

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import merge from 'deepmerge';
12
import { OrthographicView } from './orthographic-view.js';
23
import { ImageVisual } from '../visuals/image-visual.js';
34

@@ -9,32 +10,42 @@ class ImageView extends OrthographicView {
910
constructor(container, settings) {
1011
super(container, settings);
1112

12-
settings = {
13-
...{
13+
settings = merge(
14+
{
1415
renderer: {
1516
gammaOutput: true
1617
},
1718
scene: {
18-
background: new THREE.Color('#333333')
19+
background: '#333333'
1920
},
20-
camera: { position: new THREE.Vector3(0, 1, 0) },
21-
controls: { target: new THREE.Vector3(0, 0, 0) },
21+
camera: { position: { x: 0, y: 1, z: 0 } },
22+
controls: { target: { x: 0, y: 0, z: 0 } },
2223
image: 'Rose.ProPhoto.jpg',
2324
primaryColourspace: 'sRGB',
2425
secondaryColourspace: 'DCI-P3',
2526
imageColourspace: 'Primary',
2627
imageDecodingCctf: 'sRGB',
2728
colourspaceModel: 'CIE xyY'
2829
},
29-
...settings
30-
};
30+
settings || {}
31+
);
3132

3233
this.renderer.gammaOutput = settings.renderer.gammaOutput;
3334

34-
this.scene.background = settings.scene.background;
35+
this.scene.background = new THREE.Color(settings.scene.background);
3536

36-
this.camera.position.copy(settings.camera.position);
37-
this.controls.target = settings.controls.target;
37+
this.camera.position.copy(
38+
new THREE.Vector3(
39+
settings.camera.position.x,
40+
settings.camera.position.y,
41+
settings.camera.position.z
42+
)
43+
);
44+
this.controls.target = new THREE.Vector3(
45+
settings.controls.target.x,
46+
settings.controls.target.y,
47+
settings.controls.target.z
48+
);
3849

3950
this._image = settings.image;
4051
this._primaryColourspace = settings.primaryColourspace;
@@ -155,25 +166,28 @@ class ImageView extends OrthographicView {
155166
}
156167

157168
addImageVisual(settings) {
158-
this._imageVisual = new ImageVisual(this._imageVisualGroup, {
159-
...{
160-
name: 'image-visual',
161-
image: this._image,
162-
primaryColourspace: this._primaryColourspace,
163-
secondaryColourspace: this._secondaryColourspace,
164-
imageColourspace: this._imageColourspace,
165-
imageDecodingCctf: this._imageDecodingCctf
166-
},
167-
...settings
168-
});
169+
this._imageVisual = new ImageVisual(
170+
this._imageVisualGroup,
171+
merge(
172+
{
173+
name: 'image-visual',
174+
image: this._image,
175+
primaryColourspace: this._primaryColourspace,
176+
secondaryColourspace: this._secondaryColourspace,
177+
imageColourspace: this._imageColourspace,
178+
imageDecodingCctf: this._imageDecodingCctf
179+
},
180+
settings || {}
181+
)
182+
);
169183
this._imageVisual.add();
170184
}
171185

172186
addImageOverlayVisual(settings) {
173187
this._imageOverlayVisual = new ImageVisual(
174188
this._imageOverlayVisualGroup,
175-
{
176-
...{
189+
merge(
190+
{
177191
name: 'image-overlay-visual',
178192
image: this._image,
179193
primaryColourspace: this._primaryColourspace,
@@ -183,8 +197,8 @@ class ImageView extends OrthographicView {
183197
uniformOpacity: 0.5,
184198
depth: 0.5
185199
},
186-
...settings
187-
}
200+
settings || {}
201+
)
188202
);
189203
this._imageOverlayVisual.add();
190204
}

0 commit comments

Comments
 (0)