/* var ceshi = ''; // var ceshi = 'http://192.168.0.135:8105'; // var ceshi = 'http://47.107.252.54:8105'; // var token = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInJvbGUiOm51bGwsIm1hbmFnZXIiOm51bGwsImlkIjoxLCJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNTk2NzAxNjAyLCJpYXQiOjE1OTY2MTUyMDIsImp0aSI6Ijk0YjA5YTg1LWViY2ItNDE1Yy04OGVmLWU0MDM1M2UzYmIxYyJ9.Uzi95n0kYXp7bdpY77MdLtTpPL_Fq-jn0tE7gjg6AzA" var token = window.localStorage.dcj_token */ var _musicMaxWeight = 8 //M var cmp = getQueryVariable('cmp') || '' var _hotNum = 0 function reData(data, type) { return JSON.stringify(data) == type ? null : data } let strictInputNum = function(e, precision, min=0,max){//precision:保留小数位数 var value = e.target.value.trim(); var lastOne = value[value.length-1]; var preContent = value.substr(0,value.length-1) var hasPoint = precision > 0 && lastOne == '.' ; var a = Math.pow(10, precision) value = parseFloat(value) || 0; if(isNaN(value)){ e.target.value = preContent //还原 return } e.target.value = Math.max(min, parseInt(value * a) / a ) hasPoint && (e.target.value += '.')//补小数点 } //新编辑界面 var EditTools = function(n) { //main2018 里面的主要对象 this.n = n; //当前状态 this.atPanel = null; //场景信息 this.sceneInformation = new SceneInformation(); //热点 this.hotpoint = new Hotpoint(); //导览 this.editGuide = new EditGuide(); //音乐 this.EditBGM = new EditBGM(); //初始化界面 //this.init(); this.data = {} } EditTools.prototype.loadDone = function(name, data){ this.data[name] = data if('data' in this.data && 'data2' in this.data){ this.init(); } } EditTools.prototype.init = function() { this.hotpoint.init(/* this.n */); var that = this; this.initSaveAll(); this.active(); if(player.mode != 'panorama'){ $(".toolLeft li[data-name=panoVisible]").addClass('unable') player.once("pano.chosen",()=>{ $(".toolLeft li[data-name=panoVisible]").removeClass('unable') }) } //创建导览 that.EditBGM.init(this.data.data); that.sceneInformation.init(this.data.data, this.data.data2) // fyz 初始化导览需要两部分数据, 其中data2为data.js中的数据 that.editGuide.init(this.data.data, this.data.data2); $("body").on("click", function() { $(".DelConfirm").removeClass("active"); }) /* $(" .MenuOptions li").on("click", (e)=>{ var $elem = $(e.target); $elem.closest('.MenuOptions').find('li').removeClass("chosen"); $elem.addClass("chosen"); }) */ } //点击的时候激活状态 EditTools.prototype.active = function() { var that = this; var confirmSnap = $(".confirmSnap.innerBtn"); var snapshotGui = $(".snapshotGui.overlayGui"); $('.toolBottom .toolLeft li').click(function() { var name = $(this).data("name"); $('.toolLeft li[data-name=' + name + ']').addClass("active").siblings().removeClass("active"); $('.toolRight .' + name).removeClass("hide").siblings().addClass("hide"); if (name == that.atPanel) return; console.log(`atPanel ${that.atPanel} name ${name}`) switch (that.atPanel) { //退出 case "panoVisible": VisiSet.finishSetPanoVisible() break; case "panoLog": VisiSet.finishSetPanoLog() break; case "screen": confirmSnap.addClass("hide").removeClass("unable"); snapshotGui.hide(); break; case "overlay": EditOverlay.leave() break; case "hotpoint": $("#hotpointDetail").hasClass("atRight") || $("#hotpointDetail a.close").click(); VisiSet.finishSetTagVisible() that.hotpoint.wireframeModel.visible = false break; } switch (name) { case "hotpoint": that.hotpoint.wireframeModel.visible = that.hotpoint.wireframeModel.shouldShow break; case "panoVisible": $(".toolLeft").addClass("unable") VisiSet.enterSet(VisiSet.beginSetPanoVisible.bind(VisiSet)) break; case "panoLog": $(".toolLeft").addClass("unable") VisiSet.enterSet(VisiSet.beginSetPanoLog.bind(VisiSet)) break; case "screen": confirmSnap.removeClass("hide"); $('#camera-start').text("点此设置为初始画面") snapshotGui.show(); if (player.modeTran.split("-")[1] != "panorama") $(".confirmSnap").addClass("unable") break; case "overlay": EditOverlay.enter() break; } that.atPanel = name; /* if(name != "hotpoint"){ $("#hotpointDetail").hasClass("atRight") || $("#hotpointDetail a.close").click() } */ }) //滚动阻止事件 $(".toolRight div.content").on("mousewheel", function(event) { event.stopPropagation() }); // 输入框阻止事件 $('.toolRight').on('keydown', function(ev) { ev.stopPropagation(); }) } //保存按钮 EditTools.prototype.initSaveAll = function() { var that = this; $('#save').on('click', function() { $(".edit-loading").removeClass("hide"); var $shareImages = $(".information .edit-fun-images a.result"); new Promise(function(resolve, reject) {//分享图 upload($shareImages, 'images', resolve) }).then(function(imgUrls) { //导览的数据 var guides = that.editGuide.getSavingInfo()/* Array.from($('.tourFolderList ul li')).map(function(dom) { return dom.data }) */ var info = { name: $('#pjtName').val(), summary: $('#info-summary').val(), weixinDesc: $('#weixin-summary').val(), shareImgUrl: imgUrls[0] || '', backgroundMusic: that.EditBGM.musicBox.getSrc() || '', bgName: that.EditBGM.musicBox.getName(), hoticon: JSON.parse($(".hotStyle-item li.active").attr("data-val")), camera_start: $('#camera-start')[0].data, loadlogo: $("#loadlogo").is(':checked'), special: $("#g_specialScene").is(':checked'), vision_version: $("#twoData").is(':checked') ? "1.1.562.17209" : false, /************************************** 方奕卓 场景可配置项 ******************************************/ hotImageScale: $("#hotImgScale").is(':checked'), // 热点图片可放大 hideFloorMarker: $("#hideFloorMarker").is(':checked'), // 地面标记 hideMouseMarker: $("#hideMouseMarker").is(':checked'), showingLabels: $("#showingLabels").is(':checked'), // 鼠标标记 floorMarkerColor: $('#floorMarkerColor').val(), // 地面/导览标志颜色 mouseMarkerColor: $('#mouseMarkerColor').val(), // 鼠标标志颜色 momentTour: $('#tourSwitch input').is(':checked') ? 'black' : 'walk', // 导览瞬间过渡 showHotListSta: $('#hotListSwitch').is(':checked'), // 开启热点列表 hotIconScale: DATA.hotIconScale, // 热点缩放 supportsVR: $('#VRSwitch input').is(':checked'), // 开启VR功能 /**************** 陈志广 小地图可配置项 *********** */ cadSignColor: $('#cadSignColor').val(), cadBorderColor: $('#cadBorderColor').val(), cadBorderWidth: $('#cad-size').val(), showCad: $('input[name="show-cad"]').is(':checked'), } var data = { sceneCode: number, hots: reData(that.hotpoint.getSavingInfo(), '{}'), //tourAudio: reData(that.editGuide.tourAudio,'{}'),//for 旧版 name: number, guides: reData(guides, '[]'), info: info, } console.log(data) let url = cmp ? ('/api/scene/edit/' + cmp) : '/manage/scene/edit' $.ajax({ method: 'POST', headers: { 'Content-Type': 'application/json', token: token }, dataType: 'json', contentType: 'application/json', url: ceshi + url, data: JSON.stringify(data), success: function(data) { if (data.code === 0) {//成功 //manage.showInfo("保存成功") location.reload() }else if (data.code === 5001) { alert('请重新登录') localStorage.dcj_token = '' location.reload() }else{ alert(`saveAll (url:${url}) code : ${data.code} \n${data.msg}`) } } }) }); }) } //场景信息编辑 var SceneInformation = function() {} SceneInformation.prototype.init = function(data, data2) { var $options = $('.hotStyle-item li'); var $loadlogo = $("#loadlogo"); var $hotImageScale = $("#hotImgScale"); var $hideFloorMarker = $("#hideFloorMarker"); var $hideMouseMarker = $("#hideMouseMarker"); var $showingLabels = $("#showingLabels"); var $g_specialScene = $("#g_specialScene"); var $twoData = $("#twoData"); /*******************方奕卓 其他项需要用到data来初始化, 故一并放到这里 ******************/ let momentTour = $('#tourSwitch input'); // 导览瞬间过渡开关 let hotListSwitch = $('#hotListSwitch'); // 热点列表开关 let hotIconScale = $('#hotIconScale'); // 热点图标缩放 let VRSwitch = $('#VRSwitch input'); // VR功能开启 /***********************************************************************************/ $(".model-title2").text(data.name); $('#pjtName').val(data.name); $('#info-summary').val(data.summary); //if (data2) $('#weixin-summary').val(data2.weixinDesc); $('#weixin-summary').val(data.weixinDesc); for (var i = 0; i < $options.length; i++) { if ($options.eq(i).attr('data-val') === JSON.stringify(data.hoticon)) { $options.eq(i).addClass("active").siblings().removeClass("active"); } } $('#camera-start')[0].data = data.camera_start; $(".shotImg.innerBtn").on("click", ()=>{ var EntryInfo = $('#camera-start')[0].data if (EntryInfo) { var to = player.model.panos.get(EntryInfo.pano.uuid); var q = new THREE.Quaternion().fromArray(EntryInfo.camera.quaternion); var lookAtPoint = new THREE.Vector3(0,0,-1).applyQuaternion(q).add(to.position); player.flyToPano({ pano: to, lookAtPoint: lookAtPoint }) } } ) if(data.shareImgUrl){ var imagesHTML = '
' $(".information .edit-fun-images.list ").html(imagesHTML); $("#shareImgUpload").addClass("hide") } if(data.spotImgUrl){ } /*************方奕卓 其他项的初始化操作 ************/ initColorElem(data); addListener(); // 给其他元素绑定事件 if (data.momentTour === 'black') { momentTour.prop('checked', true); } if (data.showHotListSta) { hotListSwitch.prop('checked', true); } if (data.hotIconScale) { hotIconScale.val(parseFloat(data.hotIconScale)); } /* $('#hotIconScale_2 input').on('change',(e)=>{ var s = THREE.Math.clamp(parseFloat(e.target.value), 0.1, 100) e.target.value = s editTool.hotpoint.editSpot.mesh.scale.set(s,s,s) }) */ if (data.supportsVR) { VRSwitch.prop('checked', true); } /************************************************/ //隐藏公司logo if (data.loadlogo) { $loadlogo[0].checked = true showLogo(); } // 热点图片放大 if (data.hotImageScale) { $hotImageScale[0].checked = true } // 隐藏地面标记 if (data.hideFloorMarker) { $hideFloorMarker[0].checked = true } // 隐藏鼠标标记 if (data.hideMouseMarker) { $hideMouseMarker[0].checked = true } if (data.showingLabels) { $showingLabels[0].checked = true } //特殊大场景 if (data.special) { $g_specialScene[0].checked = true } //启动二代的数据 if (data.vision_version === "1.1.562.17209" || data.vision_version) { $twoData[0].checked = true } } /** * 初始化颜色选择的html元素 * @param {*} data * @param {*} elem */ function initColorElem(data, elem) { let $floorMarkerColor = $('#floorMarkerColor'); let $mouseMarkerColor = $('#mouseMarkerColor'); let $floorMarkerColorTex = $('#floorMarkerColorTex'); let $mouseMarkerColorTex = $('#mouseMarkerColorTex'); let $cadSignColor = $('#cadSignColor'); let $cadSignColorTex = $('#cadSignColorTex'); let $cadBorderColor = $('#cadBorderColor'); let $cadBorderColorTex = $('#cadBorderColorTex'); var colorRe = /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/; // 事件监听 $floorMarkerColor.on('change', function(e) { $('#floorMarkerColorTex').val(e.target.value) }) $floorMarkerColorTex.on('blur keydown', function(e) { (e.type === 'blur' || e.type === 'keydown' && e.keyCode === 13) && setColor(e, $floorMarkerColor, this); }) $mouseMarkerColor.on('change', function(e) { $('#mouseMarkerColorTex').val(e.target.value) }) $mouseMarkerColorTex.on('blur keydown', function(e) { (e.type === 'blur' || e.type === 'keydown' && e.keyCode === 13) && setColor(e, $mouseMarkerColor, this); }) // 事件监听 $cadSignColor.on('change', function(e) { $('#cadSignColorTex').val( e.target.value) }) $cadSignColorTex.on('blur keydown', function(e) { (e.type === 'blur' || e.type === 'keydown' && e.keyCode === 13) && setColor(e, $cadSignColor, this); }) // 事件监听 $cadBorderColor.on('change', function(e) { $('#cadBorderColorTex').val( e.target.value) }) $cadBorderColorTex.on('blur keydown', function(e) { (e.type === 'blur' || e.type === 'keydown' && e.keyCode === 13) && setColor(e, $cadBorderColor, this); }) // 设置颜色值 function setColor(e, colorElem, inputElem) { var isColor = colorRe.test(e.target.value); isColor && colorElem.val(e.target.value); // isColor ? colorElem.val(e.target.value): (inputElem.placeholder = colorElem.val()); } // 判断data中是否有存在的颜色值, 否则设置默认值 data.floorMarkerColor ? $floorMarkerColor.val(data.floorMarkerColor) : $floorMarkerColor.val('#4bcdfc'); data.mouseMarkerColor ? $mouseMarkerColor.val(data.mouseMarkerColor) : $mouseMarkerColor.val('#4bcdfc'); // 判断data中是否有存在的颜色值, 否则设置默认值 data.cadSignColor ? $cadSignColor.val(data.cadSignColor) : $cadSignColor.val('#00c8af'); data.cadBorderColor ? $cadBorderColor.val(data.cadBorderColor) : $cadBorderColor.val('#ffffff'); $('input[name="show-cad"]')[0].checked = !!data.showCad $('#cad-size > option[value="'+(data.cadBorderWidth ? data.cadBorderWidth : '0.01')+'"]').attr("selected",true); if (data.showCad) { $('input[name="show-cad"]').trigger('change') } $('#panoIdColor').on('change', function(e) { $('#panoIdColorTex').val(e.target.value) VisiSet.changePanoIdColor(e.target.value) }) $('#panoIdColorTex').on('blur keydown', function(e) { (e.type === 'blur' || e.type === 'keydown' && e.keyCode === 13) && setColor(e, $('#panoIdColor'), this); VisiSet.changePanoIdColor(e.target.value) }) $('#panoIdColor').val('#c13e3e')//初始颜色 $('#panoIdColorTex').val('#c13e3e') } $('input[name="show-cad"]').on('change', function(ev) { if (!ev.target.checked) { return $('.cad').hide() } let taht = this if (!taht.floorJSON) { $.ajax({ url: '//super.4dage.com/data/'+ window.number +'/floor.json', method: 'GET', success(res) { taht.floorJSON = res loadCAD(taht.floorJSON) $('#cadSignColor').on('change', function(ev) { loadCAD() }) $('#cadBorderColor').on('change', function(ev) { loadCAD() }) $('#cad-size').on('change', function(ev) { loadCAD() }) }, error() { alert('当前场景没有小地图floor.json文件,请联系三维部门添加') ev.target.checked = false } }) } else { console.log('0000000000000000000') $('.cad').show() } }) function loadCAD(data) { grendCAD(data, $('#player')[0], $('#cadSignColor').val(), $('#cadBorderColor').val(), $('#cad-size').val()) } function addListener() {} //设置初始界面 function getSeft(seft) { $('#camera-start').on('click', function() { if (VisiSet.setPanoVisible) { return VisiSet.savePanoVisibles() } else if (VisiSet.setTagVisible) { return VisiSet.saveTagVisibles() } // 这部分内容需要配合main_2018.js中来进行修改 var snap = JSON.parse("{" + seft.getSnapAngleInfo() + "}") this.data = { camera: { position: snap.metadata.camera_position, quaternion: snap.metadata.camera_quaternion// 相机朝向 }, pano: { uuid: snap.metadata.scan_id // 起始点位的id } } var ev = document.createEvent("MouseEvent"); //点击截取视图 g_snapShotWidth = 240 * 4; g_snapShotHeight = 118 * 4; window.screenSta = 'startScreen'; ev.initMouseEvent("snapshotBegin", true, true, document.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, null); ev.__callback = (imgData,info)=>{ uploadImg(imgData, (rs)=>{ if (rs.code === 0) { $(".shotImg.innerBtn").css("background-image", "url(" + rs.data + ")") this.data.thumbImg = rs.data; } } , "thumbImg.jpg") } window.dispatchEvent(ev); }); } //热点编辑 var Hotpoint = function() { this.spotList = $(".spotList"); this.hotpointDetail = $("#hotpointDetail"); this._scale = {} this.scroller = {} this.scroller.boxDepth = new SlideBar({ root: $('#boxDepth').eq(0), value: 0, min: 0 * 100, max: 1 * 100, name: "boxDepth", unitStr: "cm", avoidCrash: true, onchange: (s)=>{ if (s == 0) { this.editSpot.addBox(false) } else { this.editSpot.addBox(true) this.editSpot.scale.z = s / 100 ; this.updateTransform("scale") } }, dragEndEvent: function() { } }) // fyz 导览编辑页面同样采取热点编辑的样式, 这里确保只查找到热点编辑 } Hotpoint.prototype.init = function() { var that = this; $(".hotStyle-item li").on('click', function() {//默认样式 $(this).addClass('active').siblings().removeClass('active'); }) // 添加多媒体 this.musicBox = musicPlayBoxBind(this.hotpointDetail.find("[name=audio].mediaUpload"), null ) this.addmediaInit(); // 添加音乐 this.addModel(); // 添加模型 this.addwebPack(); // 添加外链 this.wireframeModel = new THREE.Object3D; if(Hot.allPhotoLoaded && Hot.allModelLoaded) this.initListSelect() else Hot.whenAllFileLoaded = this.initListSelect.bind(this) //等全部photo加载完 player.model.hotGroup.children.forEach(e=>this.addHotList(e) )//创建列表 this.hotpointDetail.find(".tail .submit").on('click', this.saveHot.bind(this)) { let ui = $('#hotIconScale input') let min = parseFloat(ui.attr('min')); let max = parseFloat(ui.attr('max')); ui.on("change", function(e) { var s = THREE.Math.clamp(parseFloat(e.target.value), min, max) if(isNaN(s))s = 1 e.target.value = s DATA.hotIconScale = s }) } this.isSpriteCheckBox = new CheckBox({dom: $("#isSprite"), uiCallBack : (checked)=>{ }, callbackWhenChose:(checked)=>{ that.editSpot.info.isSprite = checked; if(checked) { that.editSpot.update(player) }else{ that.editSpot.rotation.copy(that.editSpot.info.rotation) } } }) //clickEvent this.actionCheckBox = new CheckBox({dom: this.hotpointDetail.find("li[name='clickEvent'] li.editCheckbox input"), uiCallBack : (checked, name)=>{ if(name == 'openHot'){ var content = that.hotpointDetail.find("li[name='content']") checked ? content.removeClass('hide') : content.addClass('hide') } }, callbackWhenChose:(checked, name)=>{ that.editSpot.info.actionType[name] = !!checked; } }) //点击添加热点按钮 $('.hotpoint .addBtn button').on("click", function(e) { g_HotStatus = $(e.target).attr('data-type'); $("#player").css("cursor", "cell"); }); //点击热点列表弹出按钮 this.spotList.on("click", function(e) { var target = $(e.target); let li = searchParent(e.target, { className: 'listItem' }, 7); if(!li)return; var hotId = $(li).attr("data-spid"); var hot = player.model.hots[hotId] if(VisiSet.setTagVisible){ return VisiSet.SetOneTagVisible(hot) } if (target.hasClass("del")) { e.stopPropagation(); target.siblings(".DelConfirm").addClass("active"); that.spotList.find("i").text(that.spotList.find("ul li").length); } else { if (target.hasClass("DelConfirm")) { e.stopPropagation(); that.removeHot(hot); } else { //点击热点列表弹出编辑热点窗口 that.editHot(hot, $(li)) } } }); //关闭、取消 this.hotpointDetail.find("a.close, button.cancel").on("click", ()=>{ var hot = this.editSpot if(hot.isNew){ this.removeHot(hot) }else{ this.recoverInfo(hot) hot.updateVisible([player.currentPano]) } this.tempInfos && player.model.hotGroup.children.forEach(hot=>{//还原所有同时修改了的贴图和模型 var info = this.tempInfos[hot.sid] if(hot.texType == 'shine'){ hot.changeTexType(hot.texType, info.styleImg ) hot.info.styleImg = info.styleImg.map(e=>e.src) }else{ hot.changeTexType(hot.texType, info.texMedia ) hot.info.texSrc = info.texMedia.src; if(hot.texType == 'photo' && hot.info.animateInfo){ GifTexDeal.remove(hot.animation) hot.animation = GifTexDeal.addAnimation(hot.material_.map, hot, hot.info.animateInfo ) GifTexDeal.start(hot.animation) } } if(hot.objObject != info.objObject){ this.switchModel({add:info.objObject, spot:hot}) hot.info.scale.copy(info.scale) hot.scale.copy(info.scale) } }) if(this.texLists){ for(let i in this.texLists){this.texLists[i].recover()} this.modelList.recover() } this.editDone(); }); this.linkTypeMenuOptions = new MenuOptions({ //链接打开方式切换 dom: this.hotpointDetail.find(" .MenuOptions[name=linkType] "), uiCallBack : (o)=>{ }, callbackWhenChose:(o)=>{ this.editSpot.info.linkType = o.$li.attr("index") } }) this.panoTransformCheckBox = new CheckBox({dom: $('#setPosForPano input') , uiCallBack : (checked, name)=>{ }, callbackWhenChose:(checked, name)=>{ if(!checked){ delete this.editSpot.info.transformAtPanos[getTransformSid()] this.editSpot.position.copy(this.editSpot.info.position) //this.editSpot.quaternion.copy(this.editSpot.quaternion) }else{ this.getTransformAtPano('position') } } }) /* $('#setPosForPano input').on("change", ()=>{ var on = $('#setPosForPano input').is(':checked') if(!on){ delete this.editSpot.info.transformAtPanos[getTransformSid()] this.editSpot.position.copy(this.editSpot.info.position) //this.editSpot.quaternion.copy(this.editSpot.quaternion) }else{ this.getTransformAtPano('position') } }) */ //是否显示模型线框 this.wireframeModel = new THREE.Object3D; $('#wireframeSwitch input').on('change',(e)=>{ var visi = e.target.checked; if(visi && this.wireframeModel.children.length == 0){ var mat = new THREE.MeshBasicMaterial({ wireframe: true, opacity: 0.5, color: "#57e4f3", transparent: true }) this.wireframeModel.name = 'wireframeModel' player.model.chunks.forEach((mesh)=>{ var chunk = mesh.clone(); chunk.material = mat; this.wireframeModel.add(chunk) }) this.wireframeModel.visible = false player.model.add(this.wireframeModel) } this.wireframeModel.visible = visi this.wireframeModel.shouldShow = visi }) //动画 this.gifCheckBox = new CheckBox({dom: $("#gifSwitch input"), uiCallBack : (checked )=>{ $("#gifInfoEdit").css({display: checked ? 'block' : 'none'}) }, callbackWhenChose:(checked )=>{ if(checked){ that.editSpot.info.animateInfo = { cellXcount : parseInt($("#gifXCount").val()), cellYcount : parseInt($("#gifYCount").val()), voidCount : parseInt($("#voidCount").val()), loop : true, duration : parseFloat($("#gifDuration").val()) * 1000 } that.editSpot.animation = GifTexDeal.addAnimation(that.editSpot.material_.map, that.editSpot, this.editSpot.info.animateInfo, this.editSpot.sid) GifTexDeal.start(that.editSpot.animation) }else{ GifTexDeal.remove(that.editSpot.animation) that.editSpot.info.animateInfo = null } } }) {//gif动画 input let changeAnimation = function(){ GifTexDeal.setRepeart(that.editSpot.animation.animation) that.useSuitableRatio() } let restartAnimation = function(){ GifTexDeal.stop(that.editSpot.animation) GifTexDeal.start(that.editSpot.animation) } let changeFrameCount = function(){ var a = that.editSpot.info.animateInfo var frameCount = a.cellXcount * a.cellYcount - (a.voidCount||0) $("#gifFrameCount").text(frameCount) var fps = parseFloat($("#gifFps").val()) a.duration = frameCount / fps * 1000 $("#gifDuration").val(toPrecision(a.duration/1000, 2)) } let gifXCountFun = function(value){ that.editSpot.info.animateInfo.cellXcount = value var gifImgWidth = parseFloat($("#gifImgWidth").text()) var gifCellWidth = toPrecision(gifImgWidth / that.editSpot.info.animateInfo.cellXcount,1); $("#gifCellWidth").text(gifCellWidth) changeFrameCount() changeAnimation() } $("#gifXCount").on('input',(e)=>{ strictInputNum(e, 0) gifXCountFun(parseFloat(e.target.value)) }) $("#gifXCount").on('change',(e)=>{ strictInputNum(e, 0, 1) gifXCountFun(parseFloat(e.target.value)) restartAnimation() }) let gifYCountFun = function(value){ that.editSpot.info.animateInfo.cellYcount = value var gifImgHeight = parseFloat($("#gifImgHeight").text()) var gifCellHeight = toPrecision(gifImgHeight / that.editSpot.info.animateInfo.cellYcount,1); $("#gifCellHeight").text(gifCellHeight) changeFrameCount() changeAnimation() } $("#gifYCount").on('input',(e)=>{ strictInputNum(e, 0) gifYCountFun(parseFloat(e.target.value)) }) $("#gifYCount").on('change',(e)=>{ strictInputNum(e, 0, 1) gifYCountFun(parseFloat(e.target.value)) changeAnimation() restartAnimation() }) /* let gifCellWidthFun = function(value){ var gifCellWidth = value; var gifImgWidth = parseFloat($("#gifImgWidth").text()) var cellXcount = toPrecision(gifImgWidth / gifCellWidth,2); $("#gifXCount").val(cellXcount) changeAnimation() } $("#gifCellWidth").on('input',(e)=>{ strictInputNum(e, 0) gifCellWidthFun(parseFloat(e.target.value)) }) $("#gifCellWidth").on('change',(e)=>{ strictInputNum(e, 0, 1) gifCellWidthFun(parseFloat(e.target.value)) var cellXcount = $("#gifXCount").val(); var cellXcountInt = Math.round(cellXcount) if(cellXcountInt != cellXcount){ $("#gifXCount").val(cellXcountInt) gifXCountFun(cellXcountInt) changeAnimation() } restartAnimation() }) let gifCellHeightFun = function(value){ var gifCellHeight = parseFloat(e.target.value); var gifImgHeight = parseFloat($("#gifImgHeight").text()) var cellYcount = toPrecision(gifImgHeight / gifCellHeight,2); $("#gifYCount").val(cellYcount) } $("#gifCellHeight").on('input',(e)=>{ strictInputNum(e, 0) gifCellHeightFun(parseFloat(e.target.value)) }) $("#gifCellHeight").on('change',(e)=>{ strictInputNum(e, 0, 1) gifCellHeightFun(parseFloat(e.target.value)) var cellYcount = $("#gifYCount").val(); var cellYcountInt = Math.round(cellYcount) if(cellYcountInt != cellYcount){ $("#gifYCount").val(cellYcountInt) gifYCountFun(cellYcountInt) changeAnimation() } restartAnimation() })*/ $("#voidCount").on('change',(e)=>{ strictInputNum(e, 0); that.editSpot.info.animateInfo.voidCount = parseInt(e.target.value) changeFrameCount() restartAnimation() }) let gifDurationFun = function(value){ var a = that.editSpot.info.animateInfo let frameCount = a.cellXcount * a.cellYcount a.duration = value $("#gifFps").val(toPrecision(frameCount / a.duration * 1000, 1)) } $("#gifDuration").on('input',(e)=>{ strictInputNum(e, 1); gifDurationFun(parseFloat(e.target.value) * 1000) }) $("#gifDuration").on('change',(e)=>{ strictInputNum(e, 1, 0.01); gifDurationFun(parseFloat(e.target.value) * 1000) restartAnimation() }) var gifFpsFun = function(e){ strictInputNum(e, 0, 1); var fps = parseFloat(e.target.value) var a = that.editSpot.info.animateInfo let frameCount = a.cellXcount * a.cellYcount - (a.voidCount||0) a.duration = frameCount / fps * 1000 $("#gifDuration").val(toPrecision(a.duration / 1000, 2)) } $("#gifFps").on('input',(e)=>{ gifFpsFun(e) }) $("#gifFps").on('change',(e)=>{ gifFpsFun(e) restartAnimation() }) } this.modelMenuOptions = new MenuOptions({ dom: this.hotpointDetail.find(".MenuOptions[name=modelType]"), uiCallBack : (o)=>{ var name = o.name || o.$li.attr('index') if(name == "default"){ this.hotpointDetail.find('[name=boxDepthPanel]').removeClass('hide') this.updateBoxDepthPanel() this.hotpointDetail.find('[name=uploadObj]').addClass('hide') transformControls.unableScaleZ() }else{ this.hotpointDetail.find('[name=boxDepthPanel]').addClass('hide') this.hotpointDetail.find('[name=uploadObj]').removeClass('hide') } }, callbackWhenChose:(o)=>{ var name = o.$li.attr('index') if(name == "default"){ /* transformControls.unableScaleZ() this.editSpot.removeModel() */ this.switchModel({remove:true, spot:this.editSpot}) if(this._scale[this.editSpot.texType]){//恢复大小 this.editSpot.scale.copy(this._scale[this.editSpot.texType]); this.editSpot.info.scale.copy(this._scale[this.editSpot.texType]); } }else{ this.modelList.options.selectFun() this._scale[this.editSpot.texType] = this.editSpot.scale.clone() } } }) } Hotpoint.prototype.updateBoxDepthPanel = function(){ var hot = this.editSpot if (hot.info.hasBox) { this.scroller.boxDepth.setValue(hot.scale.z * 100, true) } else { this.scroller.boxDepth.setValue(0, true) } setTimeout(()=>{ this.scroller.boxDepth.InitOffset() }, 201) } /** * 显示编辑热点的窗口和初始化热点窗口的数据 */ Hotpoint.prototype.editHot = function(hot, $li) { try { transformControls.attach(hot) if(player.mode == 'panorama'){ hot.examine( { dontOpen: true, examine:true, aimDuration : 600, duration : 600 }) }else{ player.focusPoint({aim: hot.position, radius:hot.position.distanceTo(player.position)}) } } catch (e) {} if(this.editSpot == hot)return this.hotpointDetail.removeClass("atRight"); $("#hotpointDetail .audio.mediaUpload").find("input").val(''); var playIcon = 'images/play.png'; this.editSpot = hot transformControls.transformMenuOptions.updateChoseAtUI({name:'translate'}) //$(".MenuOptions[name='transform'] li[index='translate']").click()//transformControls.transCtlChangeMode("translate") this.getTempInfo(hot) hot.visible = true this.updatePano() this.updateListSelect(hot); //$("#isSprite")[0].checked = this.editSpot.info.isSprite this.isSpriteCheckBox.updateChoseAtUI(this.editSpot.info.isSprite) this.linkTypeMenuOptions.updateChoseAtUI({name:this.editSpot.info.linkType}) this.updateClickEventUI();//根据actionType更新ui var iframesHTML = hot.info.iframe.map(function(iframe) { return this.inputList("请填写网页链接", iframe) }.bind(this)) var modulesHTML = hot.info.model.map(function(module) { return this.inputList("请填写网页链接", module) }.bind(this)) var imagesHTML = hot.info.images.map(function(image) { return '' }) var videosHTML = hot.info.video.map(function(ly) { var thumb = (!ly.img || ly.img === "undefined") ? '' : '