Subversion Repositories Applications.papyrus

Rev

Rev 1318 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1318 Rev 1422
1
/*
1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
3
	All Rights Reserved.
4
 
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
9
*/
-
 
10
 
-
 
11
 
10
 
12
 
11
dojo.provide("dojo.widget.FisheyeList");
13
dojo.provide("dojo.widget.FisheyeList");
12
dojo.require("dojo.widget.*");
14
dojo.require("dojo.widget.*");
13
dojo.require("dojo.widget.HtmlWidget");
15
dojo.require("dojo.widget.HtmlWidget");
14
dojo.require("dojo.html.style");
16
dojo.require("dojo.html.style");
15
dojo.require("dojo.html.selection");
17
dojo.require("dojo.html.selection");
16
dojo.require("dojo.html.util");
18
dojo.require("dojo.html.util");
17
dojo.require("dojo.event.*");
19
dojo.require("dojo.event.*");
18
dojo.widget.defineWidget("dojo.widget.FisheyeList", dojo.widget.HtmlWidget, function () {
20
dojo.widget.defineWidget("dojo.widget.FisheyeList", dojo.widget.HtmlWidget, function () {
19
	this.pos = {x:-1, y:-1};
21
	this.pos = {x:-1, y:-1};
20
	this.EDGE = {CENTER:0, LEFT:1, RIGHT:2, TOP:3, BOTTOM:4};
22
	this.EDGE = {CENTER:0, LEFT:1, RIGHT:2, TOP:3, BOTTOM:4};
21
	this.timerScale = 1;
23
	this.timerScale = 1;
22
}, {templateString:"<div class=\"dojoHtmlFisheyeListBar\"></div>", templateCssString:".dojoHtmlFisheyeListItemLabel {\n\tfont-family: Arial, Helvetica, sans-serif;\n\tbackground-color: #eee;\n\tborder: 2px solid #666;\n\tpadding: 2px;\n\ttext-align: center;\n\tposition: absolute;\n\tdisplay: none;\n}\n\n.dojoHtmlFisheyeListItemLabel.selected {\n\tdisplay: block;\n}\n\n.dojoHtmlFisheyeListItemImage {\n\tborder: 0px;\n\tposition: absolute;\n}\n\n.dojoHtmlFisheyeListItem {\n\tposition: absolute;\n\tz-index: 2;\n}\n\n.dojoHtmlFisheyeListBar {\n\tposition: relative;\n}\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/FisheyeList.css"), isContainer:true, snarfChildDomOutput:true, itemWidth:40, itemHeight:40, itemMaxWidth:150, itemMaxHeight:150, orientation:"horizontal", conservativeTrigger:false, effectUnits:2, itemPadding:10, attachEdge:"center", labelEdge:"bottom", enableCrappySvgSupport:false, fillInTemplate:function () {
24
}, {templateString:"<div class=\"dojoHtmlFisheyeListBar\"></div>", templateCssString:".dojoHtmlFisheyeListItemLabel {\n\tfont-family: Arial, Helvetica, sans-serif;\n\tbackground-color: #eee;\n\tborder: 2px solid #666;\n\tpadding: 2px;\n\ttext-align: center;\n\tposition: absolute;\n\tdisplay: none;\n}\n\n.dojoHtmlFisheyeListItemLabel.selected {\n\tdisplay: block;\n}\n\n.dojoHtmlFisheyeListItemImage {\n\tborder: 0px;\n\tposition: absolute;\n}\n\n.dojoHtmlFisheyeListItem {\n\tposition: absolute;\n\tz-index: 2;\n}\n\n.dojoHtmlFisheyeListBar {\n\tposition: relative;\n}\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/FisheyeList.css"), isContainer:true, snarfChildDomOutput:true, itemWidth:40, itemHeight:40, itemMaxWidth:150, itemMaxHeight:150, orientation:"horizontal", conservativeTrigger:false, effectUnits:2, itemPadding:10, attachEdge:"center", labelEdge:"bottom", enableCrappySvgSupport:false, fillInTemplate:function () {
23
	dojo.html.disableSelection(this.domNode);
25
	dojo.html.disableSelection(this.domNode);
24
	this.isHorizontal = (this.orientation == "horizontal");
26
	this.isHorizontal = (this.orientation == "horizontal");
25
	this.selectedNode = -1;
27
	this.selectedNode = -1;
26
	this.isOver = false;
28
	this.isOver = false;
27
	this.hitX1 = -1;
29
	this.hitX1 = -1;
28
	this.hitY1 = -1;
30
	this.hitY1 = -1;
29
	this.hitX2 = -1;
31
	this.hitX2 = -1;
30
	this.hitY2 = -1;
32
	this.hitY2 = -1;
31
	this.anchorEdge = this._toEdge(this.attachEdge, this.EDGE.CENTER);
33
	this.anchorEdge = this._toEdge(this.attachEdge, this.EDGE.CENTER);
32
	this.labelEdge = this._toEdge(this.labelEdge, this.EDGE.TOP);
34
	this.labelEdge = this._toEdge(this.labelEdge, this.EDGE.TOP);
33
	if (this.isHorizontal && (this.anchorEdge == this.EDGE.LEFT)) {
35
	if (this.isHorizontal && (this.anchorEdge == this.EDGE.LEFT)) {
34
		this.anchorEdge = this.EDGE.CENTER;
36
		this.anchorEdge = this.EDGE.CENTER;
35
	}
37
	}
36
	if (this.isHorizontal && (this.anchorEdge == this.EDGE.RIGHT)) {
38
	if (this.isHorizontal && (this.anchorEdge == this.EDGE.RIGHT)) {
37
		this.anchorEdge = this.EDGE.CENTER;
39
		this.anchorEdge = this.EDGE.CENTER;
38
	}
40
	}
39
	if (!this.isHorizontal && (this.anchorEdge == this.EDGE.TOP)) {
41
	if (!this.isHorizontal && (this.anchorEdge == this.EDGE.TOP)) {
40
		this.anchorEdge = this.EDGE.CENTER;
42
		this.anchorEdge = this.EDGE.CENTER;
41
	}
43
	}
42
	if (!this.isHorizontal && (this.anchorEdge == this.EDGE.BOTTOM)) {
44
	if (!this.isHorizontal && (this.anchorEdge == this.EDGE.BOTTOM)) {
43
		this.anchorEdge = this.EDGE.CENTER;
45
		this.anchorEdge = this.EDGE.CENTER;
44
	}
46
	}
45
	if (this.labelEdge == this.EDGE.CENTER) {
47
	if (this.labelEdge == this.EDGE.CENTER) {
46
		this.labelEdge = this.EDGE.TOP;
48
		this.labelEdge = this.EDGE.TOP;
47
	}
49
	}
48
	if (this.isHorizontal && (this.labelEdge == this.EDGE.LEFT)) {
50
	if (this.isHorizontal && (this.labelEdge == this.EDGE.LEFT)) {
49
		this.labelEdge = this.EDGE.TOP;
51
		this.labelEdge = this.EDGE.TOP;
50
	}
52
	}
51
	if (this.isHorizontal && (this.labelEdge == this.EDGE.RIGHT)) {
53
	if (this.isHorizontal && (this.labelEdge == this.EDGE.RIGHT)) {
52
		this.labelEdge = this.EDGE.TOP;
54
		this.labelEdge = this.EDGE.TOP;
53
	}
55
	}
54
	if (!this.isHorizontal && (this.labelEdge == this.EDGE.TOP)) {
56
	if (!this.isHorizontal && (this.labelEdge == this.EDGE.TOP)) {
55
		this.labelEdge = this.EDGE.LEFT;
57
		this.labelEdge = this.EDGE.LEFT;
56
	}
58
	}
57
	if (!this.isHorizontal && (this.labelEdge == this.EDGE.BOTTOM)) {
59
	if (!this.isHorizontal && (this.labelEdge == this.EDGE.BOTTOM)) {
58
		this.labelEdge = this.EDGE.LEFT;
60
		this.labelEdge = this.EDGE.LEFT;
59
	}
61
	}
60
	this.proximityLeft = this.itemWidth * (this.effectUnits - 0.5);
62
	this.proximityLeft = this.itemWidth * (this.effectUnits - 0.5);
61
	this.proximityRight = this.itemWidth * (this.effectUnits - 0.5);
63
	this.proximityRight = this.itemWidth * (this.effectUnits - 0.5);
62
	this.proximityTop = this.itemHeight * (this.effectUnits - 0.5);
64
	this.proximityTop = this.itemHeight * (this.effectUnits - 0.5);
63
	this.proximityBottom = this.itemHeight * (this.effectUnits - 0.5);
65
	this.proximityBottom = this.itemHeight * (this.effectUnits - 0.5);
64
	if (this.anchorEdge == this.EDGE.LEFT) {
66
	if (this.anchorEdge == this.EDGE.LEFT) {
65
		this.proximityLeft = 0;
67
		this.proximityLeft = 0;
66
	}
68
	}
67
	if (this.anchorEdge == this.EDGE.RIGHT) {
69
	if (this.anchorEdge == this.EDGE.RIGHT) {
68
		this.proximityRight = 0;
70
		this.proximityRight = 0;
69
	}
71
	}
70
	if (this.anchorEdge == this.EDGE.TOP) {
72
	if (this.anchorEdge == this.EDGE.TOP) {
71
		this.proximityTop = 0;
73
		this.proximityTop = 0;
72
	}
74
	}
73
	if (this.anchorEdge == this.EDGE.BOTTOM) {
75
	if (this.anchorEdge == this.EDGE.BOTTOM) {
74
		this.proximityBottom = 0;
76
		this.proximityBottom = 0;
75
	}
77
	}
76
	if (this.anchorEdge == this.EDGE.CENTER) {
78
	if (this.anchorEdge == this.EDGE.CENTER) {
77
		this.proximityLeft /= 2;
79
		this.proximityLeft /= 2;
78
		this.proximityRight /= 2;
80
		this.proximityRight /= 2;
79
		this.proximityTop /= 2;
81
		this.proximityTop /= 2;
80
		this.proximityBottom /= 2;
82
		this.proximityBottom /= 2;
81
	}
83
	}
82
}, postCreate:function () {
84
}, postCreate:function () {
83
	this._initializePositioning();
85
	this._initializePositioning();
84
	if (!this.conservativeTrigger) {
86
	if (!this.conservativeTrigger) {
85
		dojo.event.connect(document.documentElement, "onmousemove", this, "_onMouseMove");
87
		dojo.event.connect(document.documentElement, "onmousemove", this, "_onMouseMove");
86
	}
88
	}
87
	dojo.event.connect(document.documentElement, "onmouseout", this, "_onBodyOut");
89
	dojo.event.connect(document.documentElement, "onmouseout", this, "_onBodyOut");
88
	dojo.event.connect(this, "addChild", this, "_initializePositioning");
90
	dojo.event.connect(this, "addChild", this, "_initializePositioning");
89
}, _initializePositioning:function () {
91
}, _initializePositioning:function () {
90
	this.itemCount = this.children.length;
92
	this.itemCount = this.children.length;
91
	this.barWidth = (this.isHorizontal ? this.itemCount : 1) * this.itemWidth;
93
	this.barWidth = (this.isHorizontal ? this.itemCount : 1) * this.itemWidth;
92
	this.barHeight = (this.isHorizontal ? 1 : this.itemCount) * this.itemHeight;
94
	this.barHeight = (this.isHorizontal ? 1 : this.itemCount) * this.itemHeight;
93
	this.totalWidth = this.proximityLeft + this.proximityRight + this.barWidth;
95
	this.totalWidth = this.proximityLeft + this.proximityRight + this.barWidth;
94
	this.totalHeight = this.proximityTop + this.proximityBottom + this.barHeight;
96
	this.totalHeight = this.proximityTop + this.proximityBottom + this.barHeight;
95
	for (var i = 0; i < this.children.length; i++) {
97
	for (var i = 0; i < this.children.length; i++) {
96
		this.children[i].posX = this.itemWidth * (this.isHorizontal ? i : 0);
98
		this.children[i].posX = this.itemWidth * (this.isHorizontal ? i : 0);
97
		this.children[i].posY = this.itemHeight * (this.isHorizontal ? 0 : i);
99
		this.children[i].posY = this.itemHeight * (this.isHorizontal ? 0 : i);
98
		this.children[i].cenX = this.children[i].posX + (this.itemWidth / 2);
100
		this.children[i].cenX = this.children[i].posX + (this.itemWidth / 2);
99
		this.children[i].cenY = this.children[i].posY + (this.itemHeight / 2);
101
		this.children[i].cenY = this.children[i].posY + (this.itemHeight / 2);
100
		var isz = this.isHorizontal ? this.itemWidth : this.itemHeight;
102
		var isz = this.isHorizontal ? this.itemWidth : this.itemHeight;
101
		var r = this.effectUnits * isz;
103
		var r = this.effectUnits * isz;
102
		var c = this.isHorizontal ? this.children[i].cenX : this.children[i].cenY;
104
		var c = this.isHorizontal ? this.children[i].cenX : this.children[i].cenY;
103
		var lhs = this.isHorizontal ? this.proximityLeft : this.proximityTop;
105
		var lhs = this.isHorizontal ? this.proximityLeft : this.proximityTop;
104
		var rhs = this.isHorizontal ? this.proximityRight : this.proximityBottom;
106
		var rhs = this.isHorizontal ? this.proximityRight : this.proximityBottom;
105
		var siz = this.isHorizontal ? this.barWidth : this.barHeight;
107
		var siz = this.isHorizontal ? this.barWidth : this.barHeight;
106
		var range_lhs = r;
108
		var range_lhs = r;
107
		var range_rhs = r;
109
		var range_rhs = r;
108
		if (range_lhs > c + lhs) {
110
		if (range_lhs > c + lhs) {
109
			range_lhs = c + lhs;
111
			range_lhs = c + lhs;
110
		}
112
		}
111
		if (range_rhs > (siz - c + rhs)) {
113
		if (range_rhs > (siz - c + rhs)) {
112
			range_rhs = siz - c + rhs;
114
			range_rhs = siz - c + rhs;
113
		}
115
		}
114
		this.children[i].effectRangeLeft = range_lhs / isz;
116
		this.children[i].effectRangeLeft = range_lhs / isz;
115
		this.children[i].effectRangeRght = range_rhs / isz;
117
		this.children[i].effectRangeRght = range_rhs / isz;
116
	}
118
	}
117
	this.domNode.style.width = this.barWidth + "px";
119
	this.domNode.style.width = this.barWidth + "px";
118
	this.domNode.style.height = this.barHeight + "px";
120
	this.domNode.style.height = this.barHeight + "px";
119
	for (var i = 0; i < this.children.length; i++) {
121
	for (var i = 0; i < this.children.length; i++) {
120
		var itm = this.children[i];
122
		var itm = this.children[i];
121
		var elm = itm.domNode;
123
		var elm = itm.domNode;
122
		elm.style.left = itm.posX + "px";
124
		elm.style.left = itm.posX + "px";
123
		elm.style.top = itm.posY + "px";
125
		elm.style.top = itm.posY + "px";
124
		elm.style.width = this.itemWidth + "px";
126
		elm.style.width = this.itemWidth + "px";
125
		elm.style.height = this.itemHeight + "px";
127
		elm.style.height = this.itemHeight + "px";
126
		if (itm.svgNode) {
128
		if (itm.svgNode) {
127
			itm.svgNode.style.position = "absolute";
129
			itm.svgNode.style.position = "absolute";
128
			itm.svgNode.style.left = this.itemPadding + "%";
130
			itm.svgNode.style.left = this.itemPadding + "%";
129
			itm.svgNode.style.top = this.itemPadding + "%";
131
			itm.svgNode.style.top = this.itemPadding + "%";
130
			itm.svgNode.style.width = (100 - 2 * this.itemPadding) + "%";
132
			itm.svgNode.style.width = (100 - 2 * this.itemPadding) + "%";
131
			itm.svgNode.style.height = (100 - 2 * this.itemPadding) + "%";
133
			itm.svgNode.style.height = (100 - 2 * this.itemPadding) + "%";
132
			itm.svgNode.style.zIndex = 1;
134
			itm.svgNode.style.zIndex = 1;
133
			itm.svgNode.setSize(this.itemWidth, this.itemHeight);
135
			itm.svgNode.setSize(this.itemWidth, this.itemHeight);
134
		} else {
136
		} else {
135
			itm.imgNode.style.left = this.itemPadding + "%";
137
			itm.imgNode.style.left = this.itemPadding + "%";
136
			itm.imgNode.style.top = this.itemPadding + "%";
138
			itm.imgNode.style.top = this.itemPadding + "%";
137
			itm.imgNode.style.width = (100 - 2 * this.itemPadding) + "%";
139
			itm.imgNode.style.width = (100 - 2 * this.itemPadding) + "%";
138
			itm.imgNode.style.height = (100 - 2 * this.itemPadding) + "%";
140
			itm.imgNode.style.height = (100 - 2 * this.itemPadding) + "%";
139
		}
141
		}
140
	}
142
	}
141
	this._calcHitGrid();
143
	this._calcHitGrid();
142
}, _onBodyOut:function (e) {
144
}, _onBodyOut:function (e) {
143
	if (dojo.html.overElement(dojo.body(), e)) {
145
	if (dojo.html.overElement(dojo.body(), e)) {
144
		return;
146
		return;
145
	}
147
	}
146
	this._setDormant(e);
148
	this._setDormant(e);
147
}, _setDormant:function (e) {
149
}, _setDormant:function (e) {
148
	if (!this.isOver) {
150
	if (!this.isOver) {
149
		return;
151
		return;
150
	}
152
	}
151
	this.isOver = false;
153
	this.isOver = false;
152
	if (this.conservativeTrigger) {
154
	if (this.conservativeTrigger) {
153
		dojo.event.disconnect(document.documentElement, "onmousemove", this, "_onMouseMove");
155
		dojo.event.disconnect(document.documentElement, "onmousemove", this, "_onMouseMove");
154
	}
156
	}
155
	this._onGridMouseMove(-1, -1);
157
	this._onGridMouseMove(-1, -1);
156
}, _setActive:function (e) {
158
}, _setActive:function (e) {
157
	if (this.isOver) {
159
	if (this.isOver) {
158
		return;
160
		return;
159
	}
161
	}
160
	this.isOver = true;
162
	this.isOver = true;
161
	if (this.conservativeTrigger) {
163
	if (this.conservativeTrigger) {
162
		dojo.event.connect(document.documentElement, "onmousemove", this, "_onMouseMove");
164
		dojo.event.connect(document.documentElement, "onmousemove", this, "_onMouseMove");
163
		this.timerScale = 0;
165
		this.timerScale = 0;
164
		this._onMouseMove(e);
166
		this._onMouseMove(e);
165
		this._expandSlowly();
167
		this._expandSlowly();
166
	}
168
	}
167
}, _onMouseMove:function (e) {
169
}, _onMouseMove:function (e) {
168
	if ((e.pageX >= this.hitX1) && (e.pageX <= this.hitX2) && (e.pageY >= this.hitY1) && (e.pageY <= this.hitY2)) {
170
	if ((e.pageX >= this.hitX1) && (e.pageX <= this.hitX2) && (e.pageY >= this.hitY1) && (e.pageY <= this.hitY2)) {
169
		if (!this.isOver) {
171
		if (!this.isOver) {
170
			this._setActive(e);
172
			this._setActive(e);
171
		}
173
		}
172
		this._onGridMouseMove(e.pageX - this.hitX1, e.pageY - this.hitY1);
174
		this._onGridMouseMove(e.pageX - this.hitX1, e.pageY - this.hitY1);
173
	} else {
175
	} else {
174
		if (this.isOver) {
176
		if (this.isOver) {
175
			this._setDormant(e);
177
			this._setDormant(e);
176
		}
178
		}
177
	}
179
	}
178
}, onResized:function () {
180
}, onResized:function () {
179
	this._calcHitGrid();
181
	this._calcHitGrid();
180
}, _onGridMouseMove:function (x, y) {
182
}, _onGridMouseMove:function (x, y) {
181
	this.pos = {x:x, y:y};
183
	this.pos = {x:x, y:y};
182
	this._paint();
184
	this._paint();
183
}, _paint:function () {
185
}, _paint:function () {
184
	var x = this.pos.x;
186
	var x = this.pos.x;
185
	var y = this.pos.y;
187
	var y = this.pos.y;
186
	if (this.itemCount <= 0) {
188
	if (this.itemCount <= 0) {
187
		return;
189
		return;
188
	}
190
	}
189
	var pos = this.isHorizontal ? x : y;
191
	var pos = this.isHorizontal ? x : y;
190
	var prx = this.isHorizontal ? this.proximityLeft : this.proximityTop;
192
	var prx = this.isHorizontal ? this.proximityLeft : this.proximityTop;
191
	var siz = this.isHorizontal ? this.itemWidth : this.itemHeight;
193
	var siz = this.isHorizontal ? this.itemWidth : this.itemHeight;
192
	var sim = this.isHorizontal ? (1 - this.timerScale) * this.itemWidth + this.timerScale * this.itemMaxWidth : (1 - this.timerScale) * this.itemHeight + this.timerScale * this.itemMaxHeight;
194
	var sim = this.isHorizontal ? (1 - this.timerScale) * this.itemWidth + this.timerScale * this.itemMaxWidth : (1 - this.timerScale) * this.itemHeight + this.timerScale * this.itemMaxHeight;
193
	var cen = ((pos - prx) / siz) - 0.5;
195
	var cen = ((pos - prx) / siz) - 0.5;
194
	var max_off_cen = (sim / siz) - 0.5;
196
	var max_off_cen = (sim / siz) - 0.5;
195
	if (max_off_cen > this.effectUnits) {
197
	if (max_off_cen > this.effectUnits) {
196
		max_off_cen = this.effectUnits;
198
		max_off_cen = this.effectUnits;
197
	}
199
	}
198
	var off_weight = 0;
200
	var off_weight = 0;
199
	if (this.anchorEdge == this.EDGE.BOTTOM) {
201
	if (this.anchorEdge == this.EDGE.BOTTOM) {
200
		var cen2 = (y - this.proximityTop) / this.itemHeight;
202
		var cen2 = (y - this.proximityTop) / this.itemHeight;
201
		off_weight = (cen2 > 0.5) ? 1 : y / (this.proximityTop + (this.itemHeight / 2));
203
		off_weight = (cen2 > 0.5) ? 1 : y / (this.proximityTop + (this.itemHeight / 2));
202
	}
204
	}
203
	if (this.anchorEdge == this.EDGE.TOP) {
205
	if (this.anchorEdge == this.EDGE.TOP) {
204
		var cen2 = (y - this.proximityTop) / this.itemHeight;
206
		var cen2 = (y - this.proximityTop) / this.itemHeight;
205
		off_weight = (cen2 < 0.5) ? 1 : (this.totalHeight - y) / (this.proximityBottom + (this.itemHeight / 2));
207
		off_weight = (cen2 < 0.5) ? 1 : (this.totalHeight - y) / (this.proximityBottom + (this.itemHeight / 2));
206
	}
208
	}
207
	if (this.anchorEdge == this.EDGE.RIGHT) {
209
	if (this.anchorEdge == this.EDGE.RIGHT) {
208
		var cen2 = (x - this.proximityLeft) / this.itemWidth;
210
		var cen2 = (x - this.proximityLeft) / this.itemWidth;
209
		off_weight = (cen2 > 0.5) ? 1 : x / (this.proximityLeft + (this.itemWidth / 2));
211
		off_weight = (cen2 > 0.5) ? 1 : x / (this.proximityLeft + (this.itemWidth / 2));
210
	}
212
	}
211
	if (this.anchorEdge == this.EDGE.LEFT) {
213
	if (this.anchorEdge == this.EDGE.LEFT) {
212
		var cen2 = (x - this.proximityLeft) / this.itemWidth;
214
		var cen2 = (x - this.proximityLeft) / this.itemWidth;
213
		off_weight = (cen2 < 0.5) ? 1 : (this.totalWidth - x) / (this.proximityRight + (this.itemWidth / 2));
215
		off_weight = (cen2 < 0.5) ? 1 : (this.totalWidth - x) / (this.proximityRight + (this.itemWidth / 2));
214
	}
216
	}
215
	if (this.anchorEdge == this.EDGE.CENTER) {
217
	if (this.anchorEdge == this.EDGE.CENTER) {
216
		if (this.isHorizontal) {
218
		if (this.isHorizontal) {
217
			off_weight = y / (this.totalHeight);
219
			off_weight = y / (this.totalHeight);
218
		} else {
220
		} else {
219
			off_weight = x / (this.totalWidth);
221
			off_weight = x / (this.totalWidth);
220
		}
222
		}
221
		if (off_weight > 0.5) {
223
		if (off_weight > 0.5) {
222
			off_weight = 1 - off_weight;
224
			off_weight = 1 - off_weight;
223
		}
225
		}
224
		off_weight *= 2;
226
		off_weight *= 2;
225
	}
227
	}
226
	for (var i = 0; i < this.itemCount; i++) {
228
	for (var i = 0; i < this.itemCount; i++) {
227
		var weight = this._weighAt(cen, i);
229
		var weight = this._weighAt(cen, i);
228
		if (weight < 0) {
230
		if (weight < 0) {
229
			weight = 0;
231
			weight = 0;
230
		}
232
		}
231
		this._setItemSize(i, weight * off_weight);
233
		this._setItemSize(i, weight * off_weight);
232
	}
234
	}
233
	var main_p = Math.round(cen);
235
	var main_p = Math.round(cen);
234
	var offset = 0;
236
	var offset = 0;
235
	if (cen < 0) {
237
	if (cen < 0) {
236
		main_p = 0;
238
		main_p = 0;
237
	} else {
239
	} else {
238
		if (cen > this.itemCount - 1) {
240
		if (cen > this.itemCount - 1) {
239
			main_p = this.itemCount - 1;
241
			main_p = this.itemCount - 1;
240
		} else {
242
		} else {
241
			offset = (cen - main_p) * ((this.isHorizontal ? this.itemWidth : this.itemHeight) - this.children[main_p].sizeMain);
243
			offset = (cen - main_p) * ((this.isHorizontal ? this.itemWidth : this.itemHeight) - this.children[main_p].sizeMain);
242
		}
244
		}
243
	}
245
	}
244
	this._positionElementsFrom(main_p, offset);
246
	this._positionElementsFrom(main_p, offset);
245
}, _weighAt:function (cen, i) {
247
}, _weighAt:function (cen, i) {
246
	var dist = Math.abs(cen - i);
248
	var dist = Math.abs(cen - i);
247
	var limit = ((cen - i) > 0) ? this.children[i].effectRangeRght : this.children[i].effectRangeLeft;
249
	var limit = ((cen - i) > 0) ? this.children[i].effectRangeRght : this.children[i].effectRangeLeft;
248
	return (dist > limit) ? 0 : (1 - dist / limit);
250
	return (dist > limit) ? 0 : (1 - dist / limit);
249
}, _setItemSize:function (p, scale) {
251
}, _setItemSize:function (p, scale) {
250
	scale *= this.timerScale;
252
	scale *= this.timerScale;
251
	var w = Math.round(this.itemWidth + ((this.itemMaxWidth - this.itemWidth) * scale));
253
	var w = Math.round(this.itemWidth + ((this.itemMaxWidth - this.itemWidth) * scale));
252
	var h = Math.round(this.itemHeight + ((this.itemMaxHeight - this.itemHeight) * scale));
254
	var h = Math.round(this.itemHeight + ((this.itemMaxHeight - this.itemHeight) * scale));
253
	if (this.isHorizontal) {
255
	if (this.isHorizontal) {
254
		this.children[p].sizeW = w;
256
		this.children[p].sizeW = w;
255
		this.children[p].sizeH = h;
257
		this.children[p].sizeH = h;
256
		this.children[p].sizeMain = w;
258
		this.children[p].sizeMain = w;
257
		this.children[p].sizeOff = h;
259
		this.children[p].sizeOff = h;
258
		var y = 0;
260
		var y = 0;
259
		if (this.anchorEdge == this.EDGE.TOP) {
261
		if (this.anchorEdge == this.EDGE.TOP) {
260
			y = (this.children[p].cenY - (this.itemHeight / 2));
262
			y = (this.children[p].cenY - (this.itemHeight / 2));
261
		} else {
263
		} else {
262
			if (this.anchorEdge == this.EDGE.BOTTOM) {
264
			if (this.anchorEdge == this.EDGE.BOTTOM) {
263
				y = (this.children[p].cenY - (h - (this.itemHeight / 2)));
265
				y = (this.children[p].cenY - (h - (this.itemHeight / 2)));
264
			} else {
266
			} else {
265
				y = (this.children[p].cenY - (h / 2));
267
				y = (this.children[p].cenY - (h / 2));
266
			}
268
			}
267
		}
269
		}
268
		this.children[p].usualX = Math.round(this.children[p].cenX - (w / 2));
270
		this.children[p].usualX = Math.round(this.children[p].cenX - (w / 2));
269
		this.children[p].domNode.style.top = y + "px";
271
		this.children[p].domNode.style.top = y + "px";
270
		this.children[p].domNode.style.left = this.children[p].usualX + "px";
272
		this.children[p].domNode.style.left = this.children[p].usualX + "px";
271
	} else {
273
	} else {
272
		this.children[p].sizeW = w;
274
		this.children[p].sizeW = w;
273
		this.children[p].sizeH = h;
275
		this.children[p].sizeH = h;
274
		this.children[p].sizeOff = w;
276
		this.children[p].sizeOff = w;
275
		this.children[p].sizeMain = h;
277
		this.children[p].sizeMain = h;
276
		var x = 0;
278
		var x = 0;
277
		if (this.anchorEdge == this.EDGE.LEFT) {
279
		if (this.anchorEdge == this.EDGE.LEFT) {
278
			x = this.children[p].cenX - (this.itemWidth / 2);
280
			x = this.children[p].cenX - (this.itemWidth / 2);
279
		} else {
281
		} else {
280
			if (this.anchorEdge == this.EDGE.RIGHT) {
282
			if (this.anchorEdge == this.EDGE.RIGHT) {
281
				x = this.children[p].cenX - (w - (this.itemWidth / 2));
283
				x = this.children[p].cenX - (w - (this.itemWidth / 2));
282
			} else {
284
			} else {
283
				x = this.children[p].cenX - (w / 2);
285
				x = this.children[p].cenX - (w / 2);
284
			}
286
			}
285
		}
287
		}
286
		this.children[p].domNode.style.left = x + "px";
288
		this.children[p].domNode.style.left = x + "px";
287
		this.children[p].usualY = Math.round(this.children[p].cenY - (h / 2));
289
		this.children[p].usualY = Math.round(this.children[p].cenY - (h / 2));
288
		this.children[p].domNode.style.top = this.children[p].usualY + "px";
290
		this.children[p].domNode.style.top = this.children[p].usualY + "px";
289
	}
291
	}
290
	this.children[p].domNode.style.width = w + "px";
292
	this.children[p].domNode.style.width = w + "px";
291
	this.children[p].domNode.style.height = h + "px";
293
	this.children[p].domNode.style.height = h + "px";
292
	if (this.children[p].svgNode) {
294
	if (this.children[p].svgNode) {
293
		this.children[p].svgNode.setSize(w, h);
295
		this.children[p].svgNode.setSize(w, h);
294
	}
296
	}
295
}, _positionElementsFrom:function (p, offset) {
297
}, _positionElementsFrom:function (p, offset) {
296
	var pos = 0;
298
	var pos = 0;
297
	if (this.isHorizontal) {
299
	if (this.isHorizontal) {
298
		pos = Math.round(this.children[p].usualX + offset);
300
		pos = Math.round(this.children[p].usualX + offset);
299
		this.children[p].domNode.style.left = pos + "px";
301
		this.children[p].domNode.style.left = pos + "px";
300
	} else {
302
	} else {
301
		pos = Math.round(this.children[p].usualY + offset);
303
		pos = Math.round(this.children[p].usualY + offset);
302
		this.children[p].domNode.style.top = pos + "px";
304
		this.children[p].domNode.style.top = pos + "px";
303
	}
305
	}
304
	this._positionLabel(this.children[p]);
306
	this._positionLabel(this.children[p]);
305
	var bpos = pos;
307
	var bpos = pos;
306
	for (var i = p - 1; i >= 0; i--) {
308
	for (var i = p - 1; i >= 0; i--) {
307
		bpos -= this.children[i].sizeMain;
309
		bpos -= this.children[i].sizeMain;
308
		if (this.isHorizontal) {
310
		if (this.isHorizontal) {
309
			this.children[i].domNode.style.left = bpos + "px";
311
			this.children[i].domNode.style.left = bpos + "px";
310
		} else {
312
		} else {
311
			this.children[i].domNode.style.top = bpos + "px";
313
			this.children[i].domNode.style.top = bpos + "px";
312
		}
314
		}
313
		this._positionLabel(this.children[i]);
315
		this._positionLabel(this.children[i]);
314
	}
316
	}
315
	var apos = pos;
317
	var apos = pos;
316
	for (var i = p + 1; i < this.itemCount; i++) {
318
	for (var i = p + 1; i < this.itemCount; i++) {
317
		apos += this.children[i - 1].sizeMain;
319
		apos += this.children[i - 1].sizeMain;
318
		if (this.isHorizontal) {
320
		if (this.isHorizontal) {
319
			this.children[i].domNode.style.left = apos + "px";
321
			this.children[i].domNode.style.left = apos + "px";
320
		} else {
322
		} else {
321
			this.children[i].domNode.style.top = apos + "px";
323
			this.children[i].domNode.style.top = apos + "px";
322
		}
324
		}
323
		this._positionLabel(this.children[i]);
325
		this._positionLabel(this.children[i]);
324
	}
326
	}
325
}, _positionLabel:function (itm) {
327
}, _positionLabel:function (itm) {
326
	var x = 0;
328
	var x = 0;
327
	var y = 0;
329
	var y = 0;
328
	var mb = dojo.html.getMarginBox(itm.lblNode);
330
	var mb = dojo.html.getMarginBox(itm.lblNode);
329
	if (this.labelEdge == this.EDGE.TOP) {
331
	if (this.labelEdge == this.EDGE.TOP) {
330
		x = Math.round((itm.sizeW / 2) - (mb.width / 2));
332
		x = Math.round((itm.sizeW / 2) - (mb.width / 2));
331
		y = -mb.height;
333
		y = -mb.height;
332
	}
334
	}
333
	if (this.labelEdge == this.EDGE.BOTTOM) {
335
	if (this.labelEdge == this.EDGE.BOTTOM) {
334
		x = Math.round((itm.sizeW / 2) - (mb.width / 2));
336
		x = Math.round((itm.sizeW / 2) - (mb.width / 2));
335
		y = itm.sizeH;
337
		y = itm.sizeH;
336
	}
338
	}
337
	if (this.labelEdge == this.EDGE.LEFT) {
339
	if (this.labelEdge == this.EDGE.LEFT) {
338
		x = -mb.width;
340
		x = -mb.width;
339
		y = Math.round((itm.sizeH / 2) - (mb.height / 2));
341
		y = Math.round((itm.sizeH / 2) - (mb.height / 2));
340
	}
342
	}
341
	if (this.labelEdge == this.EDGE.RIGHT) {
343
	if (this.labelEdge == this.EDGE.RIGHT) {
342
		x = itm.sizeW;
344
		x = itm.sizeW;
343
		y = Math.round((itm.sizeH / 2) - (mb.height / 2));
345
		y = Math.round((itm.sizeH / 2) - (mb.height / 2));
344
	}
346
	}
345
	itm.lblNode.style.left = x + "px";
347
	itm.lblNode.style.left = x + "px";
346
	itm.lblNode.style.top = y + "px";
348
	itm.lblNode.style.top = y + "px";
347
}, _calcHitGrid:function () {
349
}, _calcHitGrid:function () {
348
	var pos = dojo.html.getAbsolutePosition(this.domNode, true);
350
	var pos = dojo.html.getAbsolutePosition(this.domNode, true);
349
	this.hitX1 = pos.x - this.proximityLeft;
351
	this.hitX1 = pos.x - this.proximityLeft;
350
	this.hitY1 = pos.y - this.proximityTop;
352
	this.hitY1 = pos.y - this.proximityTop;
351
	this.hitX2 = this.hitX1 + this.totalWidth;
353
	this.hitX2 = this.hitX1 + this.totalWidth;
352
	this.hitY2 = this.hitY1 + this.totalHeight;
354
	this.hitY2 = this.hitY1 + this.totalHeight;
353
}, _toEdge:function (inp, def) {
355
}, _toEdge:function (inp, def) {
354
	return this.EDGE[inp.toUpperCase()] || def;
356
	return this.EDGE[inp.toUpperCase()] || def;
355
}, _expandSlowly:function () {
357
}, _expandSlowly:function () {
356
	if (!this.isOver) {
358
	if (!this.isOver) {
357
		return;
359
		return;
358
	}
360
	}
359
	this.timerScale += 0.2;
361
	this.timerScale += 0.2;
360
	this._paint();
362
	this._paint();
361
	if (this.timerScale < 1) {
363
	if (this.timerScale < 1) {
362
		dojo.lang.setTimeout(this, "_expandSlowly", 10);
364
		dojo.lang.setTimeout(this, "_expandSlowly", 10);
363
	}
365
	}
364
}, destroy:function () {
366
}, destroy:function () {
365
	dojo.event.disconnect(document.documentElement, "onmouseout", this, "_onBodyOut");
367
	dojo.event.disconnect(document.documentElement, "onmouseout", this, "_onBodyOut");
366
	dojo.event.disconnect(document.documentElement, "onmousemove", this, "_onMouseMove");
368
	dojo.event.disconnect(document.documentElement, "onmousemove", this, "_onMouseMove");
367
	dojo.widget.FisheyeList.superclass.destroy.call(this);
369
	dojo.widget.FisheyeList.superclass.destroy.call(this);
368
}});
370
}});
369
dojo.widget.defineWidget("dojo.widget.FisheyeListItem", dojo.widget.HtmlWidget, {iconSrc:"", svgSrc:"", caption:"", id:"", _blankImgPath:dojo.uri.moduleUri("dojo.widget", "templates/images/blank.gif"), templateString:"<div class=\"dojoHtmlFisheyeListItem\">" + "  <img class=\"dojoHtmlFisheyeListItemImage\" dojoAttachPoint=\"imgNode\" dojoAttachEvent=\"onMouseOver;onMouseOut;onClick\">" + "  <div class=\"dojoHtmlFisheyeListItemLabel\" dojoAttachPoint=\"lblNode\"></div>" + "</div>", fillInTemplate:function () {
371
dojo.widget.defineWidget("dojo.widget.FisheyeListItem", dojo.widget.HtmlWidget, {iconSrc:"", svgSrc:"", caption:"", id:"", _blankImgPath:dojo.uri.moduleUri("dojo.widget", "templates/images/blank.gif"), templateString:"<div class=\"dojoHtmlFisheyeListItem\">" + "  <img class=\"dojoHtmlFisheyeListItemImage\" dojoAttachPoint=\"imgNode\" dojoAttachEvent=\"onMouseOver;onMouseOut;onClick\">" + "  <div class=\"dojoHtmlFisheyeListItemLabel\" dojoAttachPoint=\"lblNode\"></div>" + "</div>", fillInTemplate:function () {
370
	if (this.svgSrc != "") {
372
	if (this.svgSrc != "") {
371
		this.svgNode = this._createSvgNode(this.svgSrc);
373
		this.svgNode = this._createSvgNode(this.svgSrc);
372
		this.domNode.appendChild(this.svgNode);
374
		this.domNode.appendChild(this.svgNode);
373
		this.imgNode.style.display = "none";
375
		this.imgNode.style.display = "none";
374
	} else {
376
	} else {
375
		if ((this.iconSrc.toLowerCase().substring(this.iconSrc.length - 4) == ".png") && (dojo.render.html.ie) && (!dojo.render.html.ie70)) {
377
		if ((this.iconSrc.toLowerCase().substring(this.iconSrc.length - 4) == ".png") && (dojo.render.html.ie) && (!dojo.render.html.ie70)) {
376
			if (dojo.dom.hasParent(this.imgNode) && this.id != "") {
378
			if (dojo.dom.hasParent(this.imgNode) && this.id != "") {
377
				var parent = this.imgNode.parentNode;
379
				var parent = this.imgNode.parentNode;
378
				parent.setAttribute("id", this.id);
380
				parent.setAttribute("id", this.id);
379
			}
381
			}
380
			this.imgNode.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.iconSrc + "', sizingMethod='scale')";
382
			this.imgNode.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.iconSrc + "', sizingMethod='scale')";
381
			this.imgNode.src = this._blankImgPath.toString();
383
			this.imgNode.src = this._blankImgPath.toString();
382
		} else {
384
		} else {
383
			if (dojo.dom.hasParent(this.imgNode) && this.id != "") {
385
			if (dojo.dom.hasParent(this.imgNode) && this.id != "") {
384
				var parent = this.imgNode.parentNode;
386
				var parent = this.imgNode.parentNode;
385
				parent.setAttribute("id", this.id);
387
				parent.setAttribute("id", this.id);
386
			}
388
			}
387
			this.imgNode.src = this.iconSrc;
389
			this.imgNode.src = this.iconSrc;
388
		}
390
		}
389
	}
391
	}
390
	if (this.lblNode) {
392
	if (this.lblNode) {
391
		this.lblNode.appendChild(document.createTextNode(this.caption));
393
		this.lblNode.appendChild(document.createTextNode(this.caption));
392
	}
394
	}
393
	dojo.html.disableSelection(this.domNode);
395
	dojo.html.disableSelection(this.domNode);
394
}, _createSvgNode:function (src) {
396
}, _createSvgNode:function (src) {
395
	var elm = document.createElement("embed");
397
	var elm = document.createElement("embed");
396
	elm.src = src;
398
	elm.src = src;
397
	elm.type = "image/svg+xml";
399
	elm.type = "image/svg+xml";
398
	elm.style.width = "1px";
400
	elm.style.width = "1px";
399
	elm.style.height = "1px";
401
	elm.style.height = "1px";
400
	elm.loaded = 0;
402
	elm.loaded = 0;
401
	elm.setSizeOnLoad = false;
403
	elm.setSizeOnLoad = false;
402
	elm.onload = function () {
404
	elm.onload = function () {
403
		this.svgRoot = this.getSVGDocument().rootElement;
405
		this.svgRoot = this.getSVGDocument().rootElement;
404
		this.svgDoc = this.getSVGDocument().documentElement;
406
		this.svgDoc = this.getSVGDocument().documentElement;
405
		this.zeroWidth = this.svgRoot.width.baseVal.value;
407
		this.zeroWidth = this.svgRoot.width.baseVal.value;
406
		this.zeroHeight = this.svgRoot.height.baseVal.value;
408
		this.zeroHeight = this.svgRoot.height.baseVal.value;
407
		this.loaded = true;
409
		this.loaded = true;
408
		if (this.setSizeOnLoad) {
410
		if (this.setSizeOnLoad) {
409
			this.setSize(this.setWidth, this.setHeight);
411
			this.setSize(this.setWidth, this.setHeight);
410
		}
412
		}
411
	};
413
	};
412
	elm.setSize = function (w, h) {
414
	elm.setSize = function (w, h) {
413
		if (!this.loaded) {
415
		if (!this.loaded) {
414
			this.setWidth = w;
416
			this.setWidth = w;
415
			this.setHeight = h;
417
			this.setHeight = h;
416
			this.setSizeOnLoad = true;
418
			this.setSizeOnLoad = true;
417
			return;
419
			return;
418
		}
420
		}
419
		this.style.width = w + "px";
421
		this.style.width = w + "px";
420
		this.style.height = h + "px";
422
		this.style.height = h + "px";
421
		this.svgRoot.width.baseVal.value = w;
423
		this.svgRoot.width.baseVal.value = w;
422
		this.svgRoot.height.baseVal.value = h;
424
		this.svgRoot.height.baseVal.value = h;
423
		var scale_x = w / this.zeroWidth;
425
		var scale_x = w / this.zeroWidth;
424
		var scale_y = h / this.zeroHeight;
426
		var scale_y = h / this.zeroHeight;
425
		for (var i = 0; i < this.svgDoc.childNodes.length; i++) {
427
		for (var i = 0; i < this.svgDoc.childNodes.length; i++) {
426
			if (this.svgDoc.childNodes[i].setAttribute) {
428
			if (this.svgDoc.childNodes[i].setAttribute) {
427
				this.svgDoc.childNodes[i].setAttribute("transform", "scale(" + scale_x + "," + scale_y + ")");
429
				this.svgDoc.childNodes[i].setAttribute("transform", "scale(" + scale_x + "," + scale_y + ")");
428
			}
430
			}
429
		}
431
		}
430
	};
432
	};
431
	return elm;
433
	return elm;
432
}, onMouseOver:function (e) {
434
}, onMouseOver:function (e) {
433
	if (!this.parent.isOver) {
435
	if (!this.parent.isOver) {
434
		this.parent._setActive(e);
436
		this.parent._setActive(e);
435
	}
437
	}
436
	if (this.caption != "") {
438
	if (this.caption != "") {
437
		dojo.html.addClass(this.lblNode, "selected");
439
		dojo.html.addClass(this.lblNode, "selected");
438
		this.parent._positionLabel(this);
440
		this.parent._positionLabel(this);
439
	}
441
	}
440
}, onMouseOut:function (e) {
442
}, onMouseOut:function (e) {
441
	dojo.html.removeClass(this.lblNode, "selected");
443
	dojo.html.removeClass(this.lblNode, "selected");
442
}, onClick:function (e) {
444
}, onClick:function (e) {
443
}});
445
}});
444
 
446