|
1023 | 1023 | this._renderer.domElement._translationSnap = Math.ceil( overall_size ) / 50; |
1024 | 1024 | if ( this._renderer.domElement.transformControl !== null ) |
1025 | 1025 | this._renderer.domElement.transformControl.attach( toplevel ); |
1026 | | - if (typeof JSROOT.progress === "function") { |
1027 | | - JSROOT.progress(); |
1028 | | - JSROOT.progress("<center>Transform Controls</center>" + |
1029 | | - "<center>'T' translate | 'R' rotate | 'S' scale</center>" + |
1030 | | - "<center>'+' increase size | '-' decrease size</center>" + |
1031 | | - "<center>'W' toggle wireframe/solid display</center>"+ |
1032 | | - "<center>keep 'Ctrl' down to snap to grid</center>"); |
1033 | | - } |
| 1026 | + this.helpText("<font face='verdana' size='1' color='red'><center>Transform Controls<br>" + |
| 1027 | + "'T' translate | 'R' rotate | 'S' scale<br>" + |
| 1028 | + "'+' increase size | '-' decrease size<br>" + |
| 1029 | + "'W' toggle wireframe/solid display<br>"+ |
| 1030 | + "keep 'Ctrl' down to snap to grid</center></font>"); |
1034 | 1031 | } |
1035 | 1032 | this._camera.near = overall_size / 200; |
1036 | 1033 | this._camera.far = overall_size * 500; |
|
1057 | 1054 | dom.onclick = function(e) { |
1058 | 1055 | this.focus(); |
1059 | 1056 | }; |
1060 | | - //dom.onmouseenter = function(e) { |
1061 | | - // this.focus(); |
1062 | | - //}; |
1063 | | - //dom.onmouseleave = function(e) { |
1064 | | - // this.blur(); |
1065 | | - //}; |
1066 | | - dom.onremove = function () { |
1067 | | - if (pthis._scene === null ) return; |
1068 | | - |
1069 | | - pthis._renderer.domElement.clock = null; |
1070 | | - if (pthis._renderer.domElement._timeoutFunc != null) |
1071 | | - clearTimeout( pthis._renderer.domElement._timeoutFunc ); |
1072 | | - if (pthis._renderer.domElement._animationId != null) |
1073 | | - cancelAnimationFrame( pthis._renderer.domElement._animationId ); |
1074 | | - |
1075 | | - pthis.deleteChildren(pthis._scene); |
1076 | | - pthis._renderer.initWebGLObjects(pthis._scene); |
1077 | | - delete pthis._scene; |
1078 | | - pthis._scene = null; |
1079 | | - if ( pthis._renderer.domElement.transformControl !== null ) |
1080 | | - pthis._renderer.domElement.transformControl.dispose(); |
1081 | | - pthis._renderer.domElement.transformControl = null; |
1082 | | - pthis._renderer.domElement.trackballControls = null; |
1083 | | - pthis._renderer.domElement.render = null; |
1084 | | - pthis._renderer = null; |
1085 | | - pthis = null; |
1086 | | - }; |
1087 | 1057 |
|
1088 | 1058 | return this.DrawingReady(); |
1089 | 1059 | } |
1090 | 1060 |
|
| 1061 | + JSROOT.TGeoPainter.prototype.Cleanup = function() { |
| 1062 | + this.helpText(); |
| 1063 | + if (this._scene === null ) return; |
| 1064 | + |
| 1065 | + this._renderer.domElement.clock = null; |
| 1066 | + if (this._renderer.domElement._timeoutFunc != null) |
| 1067 | + clearTimeout( this._renderer.domElement._timeoutFunc ); |
| 1068 | + if (this._renderer.domElement._animationId != null) |
| 1069 | + cancelAnimationFrame( this._renderer.domElement._animationId ); |
| 1070 | + |
| 1071 | + this.deleteChildren(this._scene); |
| 1072 | + //this._renderer.initWebGLObjects(this._scene); |
| 1073 | + delete this._scene; |
| 1074 | + this._scene = null; |
| 1075 | + if ( this._renderer.domElement.transformControl !== null ) |
| 1076 | + this._renderer.domElement.transformControl.dispose(); |
| 1077 | + this._renderer.domElement.transformControl = null; |
| 1078 | + this._renderer.domElement.trackballControls = null; |
| 1079 | + this._renderer.domElement.render = null; |
| 1080 | + this._renderer = null; |
| 1081 | + } |
| 1082 | + |
| 1083 | + JSROOT.TGeoPainter.prototype.helpText = function(msg) { |
| 1084 | + var id = "jsroot_helptext"; |
| 1085 | + var box = d3.select("#"+id); |
| 1086 | + var newmsg = true; |
| 1087 | + if ((typeof msg == "undefined") || (msg==null)) { |
| 1088 | + if (box.empty()) |
| 1089 | + return; |
| 1090 | + box.property('stack').pop(); |
| 1091 | + if (box.property('stack').length==0) |
| 1092 | + return box.remove(); |
| 1093 | + msg = box.property('stack')[box.property('stack').length-1]; // show prvious message |
| 1094 | + newmsg = false; |
| 1095 | + } |
| 1096 | + if (box.empty()) { |
| 1097 | + box = d3.select(document.body) |
| 1098 | + .append("div") |
| 1099 | + .attr("id", id) |
| 1100 | + .attr("class","progressbox") |
| 1101 | + .property("stack",new Array); |
| 1102 | + |
| 1103 | + box.append("p"); |
| 1104 | + } |
| 1105 | + box.select("p").html(msg); |
| 1106 | + if (newmsg) { |
| 1107 | + box.property('stack').push(msg); |
| 1108 | + box.property("showtm", new Date); |
| 1109 | + } |
| 1110 | + } |
| 1111 | + |
1091 | 1112 | JSROOT.TGeoPainter.prototype.CheckResize = function(size) { |
1092 | 1113 |
|
1093 | 1114 | var rect = this.select_main().node().getBoundingClientRect(); |
|
0 commit comments