@@ -11,7 +11,7 @@ const version_id = 'dev',
1111
1212/** @summary version date
1313 * @desc Release date in format day/month/year like '14/04/2022' */
14- version_date = '26/06 /2024',
14+ version_date = '9/07 /2024',
1515
1616/** @summary version id and date
1717 * @desc Produced by concatenation of {@link version_id} and {@link version_date}
@@ -74953,9 +74953,10 @@ class THistPainter extends ObjectPainter {
7495374953 zmin = zmax - 1;
7495474954 }
7495574955
74956- if (fp && (fp.zoom_zmin !== fp.zoom_zmax)) {
74957- zmin = fp.zoom_zmin;
74958- zmax = fp.zoom_zmax;
74956+ if (fp?.zoomChangedInteractive('z')) {
74957+ const mod = (fp.zoom_zmin !== fp.zoom_zmax);
74958+ zmin = mod ? fp.zoom_zmin : gzmin;
74959+ zmax = mod ? fp.zoom_zmax : gzmax;
7495974960 }
7496074961
7496174962 if (histo.fContour?.length > 1) {
@@ -74975,7 +74976,7 @@ class THistPainter extends ObjectPainter {
7497574976 fp.zoom_zmin = cntr.colzmin;
7497674977 fp.zoom_zmax = cntr.colzmax;
7497774978 } else
74978- fp.zoom_zmin = fp.zoom_zmax = undefined ;
74979+ fp.zoom_zmin = fp.zoom_zmax = 0 ;
7497974980 }
7498074981
7498174982 return cntr;
@@ -122083,14 +122084,16 @@ class WebWindowHandle {
122083122084 * @private */
122084122085 connect(href) {
122085122086 this.close();
122086- if (!href && this.href) href = this.href;
122087+ if (!href && this.href)
122088+ href = this.href;
122087122089
122088122090 let ntry = 0;
122089122091
122090122092 const retry_open = first_time => {
122091122093 if (this.state !== 0) return;
122092122094
122093- if (!first_time) console.log(`try connect window again ${new Date().toString()}`);
122095+ if (!first_time)
122096+ console.log(`try connect window again ${new Date().toString()}`);
122094122097
122095122098 if (this._websocket) {
122096122099 this._websocket.close();
@@ -122099,8 +122102,10 @@ class WebWindowHandle {
122099122102
122100122103 if (!href) {
122101122104 href = window.location.href;
122102- if (href && href.indexOf('#') > 0) href = href.slice(0, href.indexOf('#'));
122103- if (href && href.lastIndexOf('/') > 0) href = href.slice(0, href.lastIndexOf('/') + 1);
122105+ if (href && href.indexOf('#') > 0)
122106+ href = href.slice(0, href.indexOf('#'));
122107+ if (href && href.lastIndexOf('/') > 0)
122108+ href = href.slice(0, href.lastIndexOf('/') + 1);
122104122109 }
122105122110 this.href = href;
122106122111 ntry++;
@@ -122117,8 +122122,8 @@ class WebWindowHandle {
122117122122 console.log(`configure protocol log ${path}`);
122118122123 } else if ((this.kind === 'websocket') && first_time) {
122119122124 path = path.replace('http://', 'ws://').replace('https://', 'wss://') + 'root.websocket';
122120- path += '?' + this.getConnArgs(ntry);
122121122125 console.log(`configure websocket ${path}`);
122126+ path += '?' + this.getConnArgs(ntry);
122122122127 this._websocket = new WebSocket(path);
122123122128 } else {
122124122129 path += 'root.longpoll';
@@ -122199,7 +122204,7 @@ class WebWindowHandle {
122199122204 if (this.key && sessionKey) {
122200122205 const client_hash = HMAC(this.key, msg.slice(i0+1));
122201122206 if (server_hash !== client_hash)
122202- return console.log(`Failure checking server md5 sum ${server_hash}`);
122207+ return console.log(`Failure checking server HMAC sum ${server_hash}`);
122203122208 }
122204122209
122205122210 if (seq_id <= this.recv_seq)
@@ -122212,21 +122217,15 @@ class WebWindowHandle {
122212122217 msg = msg.slice(i4 + 1);
122213122218
122214122219 if (chid === 0) {
122215- console.log(`GET chid=0 message ${msg}`);
122220+ // console.log(`GET chid=0 message ${msg}`);
122216122221 if (msg === 'CLOSE') {
122217122222 this.close(true); // force closing of socket
122218122223 this.invokeReceiver(true, 'onWebsocketClosed');
122219122224 } else if (msg.indexOf('NEW_KEY=') === 0) {
122220- const newkey = msg.slice(8);
122221- this.close(true);
122222- let href = (typeof document !== 'undefined') ? document.URL : null;
122223- if (isStr(href) && (typeof window !== 'undefined') && window?.history) {
122224- const p = href.indexOf('?key=');
122225- if (p > 0) href = href.slice(0, p);
122226- window.history.replaceState(window.history.state, undefined, `${href}?key=${newkey}`);
122227- } else if (typeof sessionStorage !== 'undefined')
122228- sessionStorage.setItem('RWebWindow_Key', newkey);
122229- location.reload(true);
122225+ this.new_key = msg.slice(8);
122226+ this.storeKeyInUrl();
122227+ if (this._ask_reload)
122228+ this.askReload(true);
122230122229 }
122231122230 } else if (msg.slice(0, 10) === '$$binary$$') {
122232122231 this.next_binary = chid;
@@ -122265,21 +122264,33 @@ class WebWindowHandle {
122265122264 retry_open(true); // call for the first time
122266122265 }
122267122266
122268- /** @summary Send newkey request to application
122269- * @desc If server creates newkey and response - webpage will be reaload
122270- * After key generation done, connection will not be working any longer
122271- * WARNING - only call when you know that you are doing
122267+ /** @summary Ask to reload web widget
122268+ * @desc If new key already exists - reload immediately
122269+ * Otherwise request server to generate new key - and then reload page
122270+ * WARNING - call only when knowing that you are doing
122272122271 * @private */
122273- askReload() {
122274- this.send('GENERATE_KEY', 0);
122272+ askReload(force) {
122273+ if (this.new_key || force) {
122274+ this.close(true);
122275+ if (typeof location !== 'undefined')
122276+ location.reload(true);
122277+ } else {
122278+ this._ask_reload = true;
122279+ this.send('GENERATE_KEY', 0);
122280+ }
122275122281 }
122276122282
122277122283 /** @summary Instal Ctrl-R handler to realod web window
122278122284 * @desc Instead of default window reload invokes {@link askReload} method
122279122285 * WARNING - only call when you know that you are doing
122280122286 * @private */
122281122287 addReloadKeyHandler() {
122282- if (this.kind === 'file') return;
122288+ if ((this.kind === 'file') || this._handling_reload)
122289+ return;
122290+
122291+ // this websocket will handle reload
122292+ // embed widgets should not call this method
122293+ this._handling_reload = true;
122283122294
122284122295 window.addEventListener('keydown', evnt => {
122285122296 if (((evnt.key === 'R') || (evnt.key === 'r')) && evnt.ctrlKey) {
@@ -122291,6 +122302,33 @@ class WebWindowHandle {
122291122302 });
122292122303 }
122293122304
122305+ /** @summary Replace widget URL before reload or close of the page
122306+ * @private */
122307+ storeKeyInUrl() {
122308+ if (!this._handling_reload)
122309+ return;
122310+
122311+ let href = (typeof document !== 'undefined') ? document.URL : null;
122312+ if (isStr(href) && (typeof window !== 'undefined') && window?.history) {
122313+ let prefix = '&key=', p = href.indexOf(prefix);
122314+ if (p < 0) {
122315+ prefix = '?key=';
122316+ p = href.indexOf(prefix);
122317+ }
122318+ if (p > 0)
122319+ href = href.slice(0, p);
122320+ if (this.new_key)
122321+ href += prefix + this.new_key;
122322+ window.history.replaceState(window.history.state, undefined, href);
122323+ }
122324+ if (typeof sessionStorage !== 'undefined') {
122325+ sessionStorage.setItem('RWebWindow_SessionKey', sessionKey);
122326+ sessionStorage.setItem('RWebWindow_Key', this.new_key);
122327+ }
122328+ }
122329+
122330+
122331+
122294122332} // class WebWindowHandle
122295122333
122296122334/**
0 commit comments