componentViewControlMixin.js
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
export default {
defaultOption: {
viewControl: {
// perspective, orthographic.
// TODO Isometric
projection: 'perspective',
// If rotate on on init
autoRotate: false,
// cw or ccw
autoRotateDirection: 'cw',
// Degree per second
autoRotateSpeed: 10,
// Start rotating after still for a given time
// default is 3 seconds
autoRotateAfterStill: 3,
// Rotate, zoom damping.
damping: 0.8,
// Sensitivities for operations.
// Can be array to set x,y respectively
rotateSensitivity: 1,
zoomSensitivity: 1,
// Can be array to set x,y respectively
panSensitivity: 1,
// Which mouse button do rotate or pan
panMouseButton: 'middle',
rotateMouseButton: 'left',
// Distance to the target
// Only available when camera is perspective.
distance: 150,
// Min distance mouse can zoom in
minDistance: 40,
// Max distance mouse can zoom out
maxDistance: 400,
// Size of viewing volume.
// Only available when camera is orthographic
orthographicSize: 150,
maxOrthographicSize: 400,
minOrthographicSize: 20,
// Center view point
center: [0, 0, 0],
// Alpha angle for top-down rotation
// Positive to rotate to top.
alpha: 0,
// beta angle for left-right rotation
// Positive to rotate to right.
beta: 0,
minAlpha: -90,
maxAlpha: 90
// minBeta: -Infinity
// maxBeta: -Infinity
}
},
setView: function (opts) {
opts = opts || {};
this.option.viewControl = this.option.viewControl || {};
if (opts.alpha != null) {
this.option.viewControl.alpha = opts.alpha;
}
if (opts.beta != null) {
this.option.viewControl.beta = opts.beta;
}
if (opts.distance != null) {
this.option.viewControl.distance = opts.distance;
}
if (opts.center != null) {
this.option.viewControl.center = opts.center;
}
}
};