rsence-pre 2.2.0.3 → 2.2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.0.3.pre
1
+ 2.2.0.4.pre
@@ -298,7 +298,14 @@
298
298
  - propertylisteditor # HPropertyEditor
299
299
  - minimenu # HMiniMenu
300
300
  - minimenuitem # HMiniMenuItem
301
-
301
+
302
+ # Graphics related control widgets (components)
303
+ # These are not complete and there will probably never be any
304
+ # serious efforts to support legacy browsers, like old IE versions,
305
+ # unless someone is interested in sponsoring such efforts.
306
+ graphics:
307
+ - svgcontrol
308
+
302
309
  # Special packages that include other packages (not used currently)
303
310
  :compound_packages:
304
311
  allinone:
@@ -323,7 +323,13 @@ COMM.Values = HClass.extend({
323
323
  },
324
324
 
325
325
  _nativeEncode: function(_obj){
326
- return JSON.stringify( _obj );
326
+ try{
327
+ return JSON.stringify( _obj );
328
+ }
329
+ catch(e){
330
+ console.log('invalid json:',_obj);
331
+ return "{}"
332
+ }
327
333
  },
328
334
 
329
335
 
@@ -597,20 +597,21 @@ EVENT = {
597
597
  *
598
598
  **/
599
599
  mouseDown: function(e, _isLeftButton) {
600
- var _this = EVENT,
601
- _didStartDrag = false,
602
- x = _this.status[_this.crsrX],
603
- y = _this.status[_this.crsrY],
604
- i = 0,
605
-
606
- // Unset the active control when clicking on anything.
607
- _newActiveControl = null,
608
-
609
- // The startDrag and mouseDown event receivers are first collected into
610
- // these arrays and the events are sent after the active control status has
611
- // been changed.
612
- _startDragElementIds = [],
613
- _mouseDownElementIds = [];
600
+ var
601
+ _this = EVENT,
602
+ _didStartDrag = false,
603
+ x = _this.status[_this.crsrX],
604
+ y = _this.status[_this.crsrY],
605
+ i = 0,
606
+
607
+ // Unset the active control when clicking on anything.
608
+ _newActiveControl = null,
609
+
610
+ // The startDrag and mouseDown event receivers are first collected into
611
+ // these arrays and the events are sent after the active control status has
612
+ // been changed.
613
+ _startDragElementIds = [],
614
+ _mouseDownElementIds = [];
614
615
 
615
616
  _this._modifiers(e);
616
617
  if (_isLeftButton === undefined) {
@@ -665,11 +666,15 @@ EVENT = {
665
666
  Event.stop(e);
666
667
  }
667
668
  // Stop the event only when we are hovering over some control, allows normal DOM events to co-exist.
668
- if (this.enableDroppableChecks) {
669
- if ((_stopEvent === 0) && (_this.hovered.length !== 0) && _newActiveControl) {
669
+ if (_this.enableDroppableChecks) {
670
+ // console.log('stopEvent:',_stopEvent,', hoverlen:',(_this.hovered.length !== 0),', newActive:',_newActiveControl);
671
+ if ( (_mouseDownElementIds.length !== 0) && (_stopEvent === 0) && (_this.hovered.length !== 0) && _newActiveControl) {
670
672
  Event.stop(e);
671
673
  }
672
674
  }
675
+ // else {
676
+ // console.log('not enableDroppableChecks');
677
+ // }
673
678
  return true;
674
679
  },
675
680
 
@@ -725,6 +730,9 @@ EVENT = {
725
730
  _stopEvent--;
726
731
  }
727
732
  }
733
+ if( _stopEvent === 0 ){
734
+ Event.stop(e);
735
+ }
728
736
  return true;
729
737
  },
730
738
 
@@ -780,14 +788,15 @@ EVENT = {
780
788
  *
781
789
  **/
782
790
  mouseUp: function(e) {
783
- var _this = EVENT,
784
- _didEndDrag = false,
785
- _isLeftButton = Event.isLeftClick(e),
786
- x = _this.status[_this.crsrX],
787
- y = _this.status[_this.crsrY],
788
- _elemId,
789
- _ctrl,
790
- i = 0;
791
+ var
792
+ _this = EVENT,
793
+ _didEndDrag = false,
794
+ _isLeftButton = Event.isLeftClick(e),
795
+ x = _this.status[_this.crsrX],
796
+ y = _this.status[_this.crsrY],
797
+ _elemId,
798
+ _ctrl,
799
+ i = 0;
791
800
  _this._modifiers(e);
792
801
  // Send endDrag for the currently dragged items even when they don't have focus, and clear the drag item array.
793
802
  for (; i !== _this.dragItems.length; i++) {
@@ -820,7 +829,9 @@ EVENT = {
820
829
  if (_this.focused[i] === true) {
821
830
  _ctrl = _this.focusOptions[i].ctrl;
822
831
  if (_this.focusOptions[i].mouseUp === true) {
823
- _ctrl.mouseUp(x, y, _isLeftButton);
832
+ if( _ctrl.mouseUp(x, y, _isLeftButton) ){
833
+ // Event.stop(e);
834
+ }
824
835
  }
825
836
  }
826
837
  }
File without changes
@@ -0,0 +1,400 @@
1
+ /* RSence
2
+ * Copyright 2009 Riassence Inc.
3
+ * http://riassence.com/
4
+ *
5
+ * You should have received a copy of the GNU General Public License along
6
+ * with this software package. If not, contact licensing@riassence.com
7
+ */
8
+
9
+ var//RSence.Graphics
10
+ SVGControl = HControl.extend({
11
+ isSVGContainer: true,
12
+ _svgNS: 'http://www.w3.org/2000/svg',
13
+ _pictElemStyle: [
14
+ // 'width:100%',
15
+ // 'height:100%',
16
+ 'position:absolute',
17
+ 'top:0px',
18
+ 'left:0px',
19
+ 'right:0px',
20
+ 'bottom:0px'
21
+ ].join(';'),
22
+ getPictElem: function(){
23
+ return ELEM.get( this.pictId );
24
+ },
25
+ getPictElemById: function( _pictElemId ){
26
+ return this._pictElemIds[ _pictElemId ];
27
+ },
28
+ _pictElemIds: null,
29
+ _freePictElemIds: null,
30
+
31
+ _nextPictElemId: function(){
32
+ var
33
+ _this = this,
34
+ _nodeId = ( _this._freePictElemIds.length === 0 )?_this._pictElemIds.length:_this._freePictElemIds.shift();
35
+ // console.log( 'nodeId:', _nodeId );
36
+ return _nodeId;
37
+ },
38
+
39
+ _makePictElem: function( _parentId, _type ){
40
+ _parentId = _parentId?_parentId:0;
41
+ var
42
+ _this = this,
43
+ _nodeId = _this._nextPictElemId(),
44
+ _objectNode = document.createElementNS( _this._svgNS, _type ),
45
+ _parentNode = _this._pictElemIds[_parentId];
46
+ if(_parentNode === undefined || _parentNode === null){
47
+ // console.log('invalid parent',_parentNode,', parentId:',_parentId,', type:',_type,', nodeId:',_nodeId,', pictElemIds:',_this._pictElemIds);
48
+ _parentNode = _this._pictElemIds[0];
49
+ }
50
+ _this._pictElemIds[_nodeId] = _objectNode;
51
+ // if ( !_parentNode ) {
52
+ // console.log('no parent', _parentNode);
53
+ // _parentNode = _this._pictElemIds[0];
54
+ // }
55
+ _parentNode.appendChild( _objectNode );
56
+ return _nodeId;
57
+ },
58
+
59
+ _deletePictElem: function(_nodeId){
60
+ var
61
+ _this = this,
62
+ _objectNode = _this._pictElemIds[_nodeId],
63
+ _parentNode = _objectNode.parentNode;
64
+ _parentNode.removeChild(_objectNode);
65
+ _this._pictElemIds[_nodeId] = null;
66
+ _this._freePictElemIds.push(_nodeId);
67
+ },
68
+
69
+ makeGroupElem: function( _rect, _parentId, _options ){
70
+ var
71
+ _this = this,
72
+ _nodeId = _this._makePictElem( _parentId, 'g' );
73
+ _this.setAttrsOfPictElem(
74
+ _nodeId,
75
+ _this._attrParse(
76
+ _options.attr, {
77
+ // x: _rect[0],
78
+ // y: _rect[1],
79
+ // width: _rect[2],
80
+ // height: _rect[3]
81
+ },
82
+ _options.style
83
+ )
84
+ );
85
+ return _nodeId;
86
+ },
87
+
88
+ // rect: [0,10,100,200] => [x=0,y=10,w=100,h=200]
89
+ // parentId: pictIds[n] || null => 0
90
+ // options: {
91
+ // style: { fill: 'rgb(0,0,255)', 'stroke-width': 1, stroke: 'rgb(0,0,0)' }
92
+ // attrs: { x: 0, y: 10, width: 100, height: 200 }
93
+ makeRectElem: function( _rect, _parentId, _options ){
94
+ var
95
+ _this = this,
96
+ _nodeId = _this._makePictElem( _parentId, 'rect' );
97
+ _this.setAttrsOfPictElem(
98
+ _nodeId,
99
+ _this._attrParse(
100
+ _options.attr, {
101
+ x: _rect[0],
102
+ y: _rect[1],
103
+ width: _rect[2],
104
+ height: _rect[3]
105
+ },
106
+ _options.style
107
+ )
108
+ );
109
+ return _nodeId;
110
+ },
111
+ // circle: [50,60,100] => [centerX=50,centerY=60,radius=100]
112
+ makeCircleElem: function( _circle, _parentId, _options ){
113
+ var
114
+ _this = this,
115
+ _nodeId = _this._makePictElem( _parentId, 'circle' );
116
+ _this.setAttrsOfPictElem(
117
+ _nodeId,
118
+ _this._attrParse(
119
+ _options.attr, {
120
+ cx: _circle[0],
121
+ cy: _circle[1],
122
+ r: _circle[2]
123
+ },
124
+ _options.style
125
+ )
126
+ );
127
+ return _nodeId;
128
+ },
129
+ // _ellipse: [ 50, 60, 25, 40 ] => [centerX=50,centerY=60,radiusX=25,radiusY=40]
130
+ makeEllipseElem: function( _ellipse, _parentId, _options ){
131
+ var
132
+ _this = this,
133
+ _nodeId = _this._makePictElem( _parentId, 'ellipse' );
134
+ _this.setAttrsOfPictElem(
135
+ _nodeId,
136
+ _this._attrParse(
137
+ _options.attr, {
138
+ cx: _ellipse[0],
139
+ cy: _ellipse[1],
140
+ rx: _ellipse[2],
141
+ ry: _ellipse[3]
142
+ },
143
+ _options.style
144
+ )
145
+ );
146
+ return _nodeId;
147
+ },
148
+ // _line: [ 50, 60, 25, 40 ] => [x1=50,y1=60,x2=25,y2=40]
149
+ makeLineElem: function( _line, _parentId, _options ){
150
+ var
151
+ _this = this,
152
+ _nodeId = _this._makePictElem( _parentId, 'line' );
153
+ _this.setAttrsOfPictElem(
154
+ _nodeId,
155
+ _this._attrParse(
156
+ _options.attr, {
157
+ x1: _line[0],
158
+ y1: _line[1],
159
+ x2: _line[2],
160
+ y2: _line[3]
161
+ },
162
+ _options.style
163
+ )
164
+ );
165
+ return _nodeId;
166
+ },
167
+ // _points: [ [50, 60], [25, 40] ] => [point1=[x:50,y1:60],point2=[x:25,y:40]]
168
+ makePolylineElem: function( _points, _parentId, _options ){
169
+ var
170
+ _this = this,
171
+ _nodeId = _this._makePictElem( _parentId, 'polyline' ),
172
+ _pointsArr = [],
173
+ i = 0;
174
+ for(;i<_points.length;i++){
175
+ _pointsArr.push( _points[i].join(',') );
176
+ }
177
+ _this.setAttrsOfPictElem(
178
+ _nodeId,
179
+ _this._attrParse(
180
+ _options.attr, {
181
+ points: _pointsArr.join(' ')
182
+ },
183
+ _options.style
184
+ )
185
+ );
186
+ return _nodeId;
187
+ },
188
+ makePolyLineElem: function( _points, _parentId, _options ){
189
+ return this.makePolylineElem( _points, _parentId, _options );
190
+ },
191
+ // _points: [ [50, 60], [25, 40] ] => [point1=[x:50,y1:60],point2=[x:25,y:40]]
192
+ makePolygonElem: function( _points, _parentId, _options ){
193
+ var
194
+ _this = this,
195
+ _nodeId = _this._makePictElem( _parentId, 'polygon' ),
196
+ _pointsArr = [],
197
+ i = 0;
198
+ for(;i<_points.length;i++){
199
+ _pointsArr.push( _points[i].join(',') );
200
+ }
201
+ _this.setAttrsOfPictElem(
202
+ _nodeId,
203
+ _this._attrParse(
204
+ _options.attr, {
205
+ points: _pointsArr.join(' ')
206
+ },
207
+ _options.style
208
+ )
209
+ );
210
+ return _nodeId;
211
+ },
212
+ // _path: "M0.208,16.918c0,0,126.866-58.208,126.866,132.836"
213
+ makePathElem: function( _path, _parentId, _options ){
214
+ var
215
+ _this = this,
216
+ _nodeId = _this._makePictElem( _parentId, 'path' );
217
+
218
+ _this.setAttrsOfPictElem(
219
+ _nodeId,
220
+ _this._attrParse(
221
+ _options.attr, {
222
+ d: _path
223
+ },
224
+ _options.style
225
+ )
226
+ );
227
+ return _nodeId;
228
+ },
229
+ _styleAttrParse: function( _style, _optStyle ) {
230
+ if ( !_style ) {
231
+ _style = {};
232
+ }
233
+ if ( !_optStyle ) {
234
+ _optStyle = {};
235
+ }
236
+ var _styleList = [],
237
+ i;
238
+ for( i in _optStyle ) {
239
+ if( _optStyle[i] !== null && _optStyle[i] !== undefined ){
240
+ _style[i] = _optStyle[i];
241
+ }
242
+ }
243
+ for( i in _style ) {
244
+ if( _style[i] !== null && _style[i] !== undefined ){
245
+ _styleList.push( [ i, _style[i] ].join(':') );
246
+ }
247
+ }
248
+ return _styleList.join(';');
249
+ },
250
+ _attrParse: function( _attrs, _defaultAttrs, _styleAttrs ) {
251
+ if ( !_attrs ) {
252
+ _attrs = {};
253
+ }
254
+ for( var i in _defaultAttrs ){
255
+ if( _attrs[i] === null ||
256
+ _attrs[i] === undefined ) {
257
+ _attrs[i] = _defaultAttrs[i];
258
+ }
259
+ }
260
+ _attrs.style = this._styleAttrParse( _attrs.style, _styleAttrs );
261
+ return _attrs;
262
+ },
263
+ setAttrsOfPictElem: function( _pictElemId, _attrs ) {
264
+ for ( i in _attrs ) {
265
+ if( _attrs[i] !== null && _attrs[i] !== undefined ){
266
+ this.setAttrOfPictElem( _pictElemId, i, _attrs[i] );
267
+ }
268
+ }
269
+ },
270
+ setAttrOfPictElem: function( _pictElemId, _pictAttrName, _pictAttrValue ) {
271
+ this._pictElemIds[_pictElemId].setAttributeNS( null, _pictAttrName, _pictAttrValue );
272
+ },
273
+ drawRect: function(){
274
+ if(!this.drawn){
275
+ this.makeSvgElem();
276
+ }
277
+ this.base();
278
+ // this.setViewBox( 0, 0, this.rect.width, this.rect.height );
279
+ },
280
+ // setViewBox: function( left, top, right, bottom ){
281
+ // ELEM.get(this.pictId).setAttribute( 'viewBox', '0 0 '+this.rect.width+' '+this.rect.height );
282
+ // },
283
+ makeSvgElem: function(){
284
+ var _this = this,
285
+ _pict = document.createElementNS( _this._svgNS, 'svg' ),
286
+ _pictElemId = ELEM._add( _pict );
287
+ _this._pictElemIds = [];
288
+ _this._freePictElemIds = [];
289
+
290
+ // parentId not used as elemId elsewhere
291
+ _this.pictId = _pictElemId;
292
+
293
+ _this._pictElemIds[0] = _pict;
294
+ ELEM.append( _pictElemId, _this.elemId );
295
+ _pict.setAttribute( 'xmlns', _this._svgNS );
296
+ // console.log('options:',this.options);
297
+ if(this.options['viewBox'] !== undefined){
298
+ this.viewBox = this.options.viewBox.join(' ');
299
+ }
300
+ else {
301
+ this.viewBox = '0 0 '+this.rect.width+' '+this.rect.height;
302
+ }
303
+ if(this.options['preserveAspectRatio'] !== undefined){
304
+ this.preserveAspectRatio = this.options.preserveAspectRatio;
305
+ }
306
+ else {
307
+ this.preserveAspectRatio = 'xMidYMid slice';
308
+ }
309
+ _pict.setAttribute( 'viewBox', this.viewBox );
310
+ _pict.setAttribute( 'preserveAspectRatio', this.preserveAspectRatio );
311
+ _pict.setAttribute( 'version', '1.1' );
312
+ _pict.style.cssText = _this._pictElemStyle;
313
+ _this.setAttrsOfPictElem(
314
+ 0, {
315
+ // viewBox: '0 0 320 240',
316
+ // width: '100%',
317
+ // height: '100%'
318
+ }
319
+ );
320
+ }
321
+ }),
322
+ HPict = SVGControl; // Compatibility for legacy code.
323
+
324
+ var//RSence.Graphics
325
+ SVGItemBase = HClass.extend({
326
+ constructor: function( _shape, _parent, _options ){
327
+ this.shape = _shape;
328
+ this.parent = _parent;
329
+ this.options = _options;
330
+ this.parents = [];
331
+ var i = 0;
332
+ for( ; i < this.parent.parents.length; i++ ){
333
+ this.parents.push( this.parent.parents[i] );
334
+ }
335
+ this.parents.push( this.parent );
336
+ for( i = this.parents.length-1; i > -1; i-- ){
337
+ if( this.parents[i].isSVGContainer ){
338
+ this.pict = this.parents[i];
339
+ break;
340
+ }
341
+ }
342
+
343
+ // parentId not used as elemId elsewhere
344
+ this.pictId = this.makeItem( _shape, _parent.pictId, _options );
345
+
346
+ //console.log(_parent.pictId);
347
+ this.extAction();
348
+ },
349
+ pictItemType: '',
350
+ makeItem: function( _shape, _parentId, _options ){
351
+ return this.pict['make'+this.pictItemType+'Elem']( _shape, _parentId, _options );
352
+ },
353
+ extAction: function(){}
354
+ }, {
355
+ factory: function(_pictItemType){
356
+ var _ext = {};
357
+ _ext['pictItemType'] = _pictItemType;
358
+ return SVGItemBase.extend(_ext);
359
+ }
360
+ }),
361
+ HPictItem = SVGItemBase; // Compatibility for legacy code.
362
+
363
+ var//RSence.Graphics
364
+ SVGRect = SVGItemBase.factory('Rect'),
365
+ HPictRect = SVGRect; // Compatibility for legacy code.
366
+
367
+ var//RSence.Graphics
368
+ SVGCircle = SVGItemBase.factory('Circle'),
369
+ HPictCircle = SVGCircle; // Compatibility for legacy code.
370
+
371
+ var//RSence.Graphics
372
+ SVGEllipse = SVGItemBase.factory('Ellipse'),
373
+ HPictEllipse = SVGEllipse; // Compatibility for legacy code.
374
+
375
+ var//RSence.Graphics
376
+ SVGOval = HPictEllipse,
377
+ HPictOval = SVGOval; // Compatibility for legacy code.
378
+
379
+ var//RSence.Graphics
380
+ SVGLine = SVGItemBase.factory('Line'),
381
+ HPictLine = SVGLine; // Compatibility for legacy code.
382
+
383
+ var//RSence.Graphics
384
+ SVGPolyLine = SVGItemBase.factory('Polyline'),
385
+ HPictPolyLine = SVGPolyLine, // Compatibility for legacy code.
386
+ SVGPolyline = SVGPolyLine, // Aliases
387
+ HPictPolyline = SVGPolyLine; // Aliases
388
+
389
+ var//RSence.Graphics
390
+ SVGPolygon = SVGItemBase.factory('Polygon'),
391
+ HPictPolygon = SVGPolygon; // Compatibility for legacy code.
392
+
393
+ var//RSence.Graphics
394
+ SVGGroup = SVGItemBase.factory('Group'),
395
+ HPictGroup = SVGGroup; // Compatibility for legacy code.
396
+
397
+ var//RSence.Graphics
398
+ SVGPath = SVGItemBase.factory('Path'),
399
+ HPictPath = SVGPath; // Compatibility for legacy code.
400
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence-pre
3
3
  version: !ruby/object:Gem::Version
4
- hash: 121
4
+ hash: 119
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 2
9
9
  - 0
10
- - 3
11
- version: 2.2.0.3
10
+ - 4
11
+ version: 2.2.0.4
12
12
  platform: ruby
13
13
  authors:
14
14
  - Riassence Inc.
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-03-29 00:00:00 +03:00
19
+ date: 2011-03-30 00:00:00 +03:00
20
20
  default_executable: rsence-pre
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -344,6 +344,8 @@ files:
344
344
  - js/foundation/view/view.js
345
345
  - js/foundation/view/viewdefaults/js.inc
346
346
  - js/foundation/view/viewdefaults/viewdefaults.js
347
+ - js/graphics/svgcontrol/js.inc
348
+ - js/graphics/svgcontrol/svgcontrol.js
347
349
  - js/lists/checkboxlist/checkboxlist.js
348
350
  - js/lists/checkboxlist/js.inc
349
351
  - js/lists/listitems/js.inc