From b65be194a42f1dbf2d1ff45218b37e39b16211b3 Mon Sep 17 00:00:00 2001 From: Evgeny Gagua Date: Mon, 11 Sep 2023 16:58:28 +0000 Subject: [PATCH] Custom Map Stage 1 --- lib/javascript/clipchamp/player.js | 45 ++++++++++++++++--- lib/javascript/jsapi_dynamic/mojo_settings.js | 34 +++++++++----- 2 files changed, 60 insertions(+), 19 deletions(-) diff --git a/lib/javascript/clipchamp/player.js b/lib/javascript/clipchamp/player.js index 0cc2362..a4b30bc 100644 --- a/lib/javascript/clipchamp/player.js +++ b/lib/javascript/clipchamp/player.js @@ -15,7 +15,16 @@ (function($) { var DEFAULT_FPS = 15, DEFAULT_AUTOLOOP = true, - JPEG_MAGIG_NUMBER = [0xff, 0xd8, 0xff], CONTINUE_PLAY = true, imageElement = null, nextFrameIndex = 0, jpegUrl, jpegFiles = null, autoloop = false, fps =1, ran=null; + JPEG_MAGIG_NUMBER = [0xff, 0xd8, 0xff], + CONTINUE_PLAY = true, + imageElement = null, + nextFrameIndex = 0, + jpegUrl, + jpegFiles = null, + autoloop = false, + fps =1, + ran=null, + timerBOBA = null; var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout; function showNextFrame() { @@ -30,12 +39,22 @@ if (imageElement) { if (autoloop || nextFrameIndex < jpegFiles.length) { nextFrameIndex = (nextFrameIndex === jpegFiles.length) ? 0 : nextFrameIndex; - ran.value = nextFrameIndex; + if( ( nextFrameIndex % fps ) == 0 ) ran.value = nextFrameIndex; - if( CONTINUE_PLAY ) - setTimeout(function() { + if( CONTINUE_PLAY ) { + if( timerBOBA == null ){ + timerBOBA = setInterval( + //setTimeout( + function() { requestAnimationFrame(showNextFrame); }, 1000/fps); + }; + } else { + if( timerBOBA!= null ){ + clearInterval( timerBOBA ); + timerBOBA = null; + }; + }; } } }; @@ -119,11 +138,23 @@ ctlDIV.appendChild(btn); dWE.appendChild(ctlDIV); if (jpegFiles.length > 0) { - - - if( CONTINUE_PLAY ) setTimeout(function() { + if( CONTINUE_PLAY ) { + if( timerBOBA == null ){ + timerBOBA = setInterval( + //setTimeout( + function() { requestAnimationFrame(showNextFrame); }, 1000/fps); + }; + } else { + if( timerBOBA!= null ){ + clearInterval( timerBOBA ); + timerBOBA = null; + }; + }; + //if( CONTINUE_PLAY ) setTimeout(function() { + // requestAnimationFrame(showNextFrame); + //}, 1000/fps); } else { alert('Error Loading Video'); }; diff --git a/lib/javascript/jsapi_dynamic/mojo_settings.js b/lib/javascript/jsapi_dynamic/mojo_settings.js index 8a6c018..f60501e 100644 --- a/lib/javascript/jsapi_dynamic/mojo_settings.js +++ b/lib/javascript/jsapi_dynamic/mojo_settings.js @@ -2273,7 +2273,7 @@ function showSettingsApplication(){ //items:{ xtype: 'panel', id: 'sys_location_map', - height: PanelH-150, + height: PanelH-170, html: ' ', listeners:{ afterrender: function( t, state ){ @@ -2294,21 +2294,30 @@ function showSettingsApplication(){ textAlign: 'center' }, items:[{ + border: false, html: 'GetLabel('_SYS_ANCHORT_LBL_');?> GetLabel('_LAT_SHORT_LBL_');?>:' },{ - xtype: 'textfield', + xtype: 'numberfield', id: 'siteLat', + decimalPrecision: 8, + width: 100, value: SiteLat },{ + border: false, html: 'GetLabel('_LON_SHORT_LBL_');?>:' },{ - xtype: 'textfield', + xtype: 'numberfield', + width: 100, + decimalPrecision: 8, id: 'siteLon', value: SiteLon },{ + border: false, html: 'GetLabel('_ALT_SHORT_LBL_');?>:' },{ - xtype: 'textfield', + xtype: 'numberfield', + decimalPrecision: 2, + width: 100, id: 'siteAlt', value: SiteAlt },{ @@ -2316,8 +2325,9 @@ function showSettingsApplication(){ text: 'GetLabel('_UPDATE_LBL_');?>', handler: updateSiteAnchor },{ + border: false, html: 'GetLabel('_MAP_TYP_LBL_');?>:' - },{ + },/*{ xtype: 'radio', name: 'map_type', boxLabel: 'GetLabel('_MAP_REG_LBL_');?>', @@ -2329,21 +2339,21 @@ function showSettingsApplication(){ boxLabel: 'GetLabel('_MAP_CUST_LBL_');?>', colspan: 2, value: 1 - },{ + },*/{ xtype: 'combo', - disabled: true, + disabled: false, typeAhead: true, triggerAction: 'all', lazyRender:true, - colspan: 2, + colspan: 5, mode: 'local', store: new Ext.data.ArrayStore({ id: 0, - fields: ['myId', 'displayText' ], - data: [[1, 'item1'], [2, 'item2']] + fields: ['map_id', 'map_text' ], + data: [[1, 'OpenStreetMap'], [2, 'OpenTopoMap'], [3, 'EsriSat'], [4, 'EsriStreet'], [5, 'EsriTopo']] }), - valueField: 'myId', - displayField: 'displayText' + valueField: 'map_id', + displayField: 'map_text' },{ xtype: 'button',