source: main/trunk/greenstone3/web/interfaces/default/js/panoramaMarker.js@ 26872

Last change on this file since 26872 was 26872, checked in by davidb, 11 years ago

Support files to provide a Panorama viewer. Falls back to a canvas element if the browser does not support WebGL

File size: 1.3 KB
Line 
1function BaseMarker() {
2 this._scrX = 0;
3 this._scrY = 0;
4 this._live = true;
5}
6
7BaseMarker.prototype = {
8 constructor: BaseMarker,
9 setPosition: function(x, y) {
10 this._scrX = x;
11 this._scrY = y;
12 this.style.left = x + 'px';
13 this.style.top = y + 'px';
14 },
15 getX: function() { return this._scrX; },
16 getY: function() { return this._scrY; },
17 visible: function(value) {
18 var isVisible = (this.style.display != 'none');
19 if(value === undefined) {
20 return isVisible;
21 } else {
22 if(value != isVisible) {
23 this.style.display = (value)?'block':'none';
24 }
25 return value;
26 }
27 },
28 activate: function() {
29 this._live = true;
30 },
31 deactivate: function() {
32 this._live = false;
33 }
34};
35
36function NavMarker(_hash, initObj) {
37 BaseMarker.call(this);
38 this.className = 'navigate-point';
39 this.hash = _hash;
40 this.position = new THREE.Vector3(initObj.x, initObj.y, initObj.z);
41 this.unitVector = new THREE.Vector3(initObj.x, initObj.y, initObj.z).normalize();
42}
43
44NavMarker.prototype = new BaseMarker();
45NavMarker.prototype.constructor = NavMarker;
46
47//factory function to create a PosMarker extends a Div element
48NavMarker.create = function(index, initObj) {
49 var element = document.createElement('div');
50 $.extend(element, NavMarker.prototype);
51 NavMarker.apply(element, arguments);
52 return element;
53};
Note: See TracBrowser for help on using the repository browser.