|
@@ -1520,7 +1520,7 @@ Hotpoint.prototype.inputList = function(text, val) {
|
|
|
}
|
|
|
//添加热点模型
|
|
|
Hotpoint.prototype.addModel = function() {
|
|
|
- var text = this.inputList("请填写模型链接");
|
|
|
+ var text = this.inputList("请填写模型链接(https开头)");
|
|
|
this.hotpointDetail.find(".model .add").on('click', function() {
|
|
|
$(this).closest(".model").find(".list").append(text)
|
|
|
});
|
|
@@ -3458,6 +3458,14 @@ var EditOverlay = {
|
|
|
//$('#overlayUpload .preview').css('background-image',"").append($(video));
|
|
|
|
|
|
this.useImgRatio()
|
|
|
+ this.updateGifPanel(this.editPlane)
|
|
|
+
|
|
|
+ if(this.editPlane.animateInfo){
|
|
|
+ GifTexDeal.remove(this.editPlane.animation)
|
|
|
+ this.editPlane.animation = GifTexDeal.addAnimation(this.editPlane.plane.material.map, this.editPlane, this.editPlane.animateInfo, this.editPlane.sid)
|
|
|
+ GifTexDeal.start(this.editPlane.animation)
|
|
|
+ }
|
|
|
+
|
|
|
//自适应比例
|
|
|
this.editPlane.file = photo.file;
|
|
|
plane.material.opacity = 1;
|
|
@@ -3478,11 +3486,190 @@ var EditOverlay = {
|
|
|
else {
|
|
|
this.getOverlayInfo(overlay)
|
|
|
}
|
|
|
-
|
|
|
this.addToList(overlay)
|
|
|
- }
|
|
|
- )
|
|
|
+ } )
|
|
|
|
|
|
+ $("#gifSwitch input").on("change", (e)=>{
|
|
|
+ var on = $("#gifSwitch input").is(':checked');
|
|
|
+ $("#gifInfoEdit").css({display: on ? 'block' : 'none'})
|
|
|
+ if(on){
|
|
|
+ EditOverlay.editPlane.animateInfo = {
|
|
|
+ cellXcount : parseInt($("#gifXCount").val()),
|
|
|
+ cellYcount : parseInt($("#gifYCount").val()),
|
|
|
+ loop : true,
|
|
|
+ duration : parseFloat($("#gifDuration").val()) * 1000
|
|
|
+ }
|
|
|
+ EditOverlay.editPlane.animation = GifTexDeal.addAnimation(EditOverlay.editPlane.plane.material.map, EditOverlay.editPlane, EditOverlay.editPlane.animateInfo, EditOverlay.editPlane.sid)
|
|
|
+ GifTexDeal.start(EditOverlay.editPlane.animation)
|
|
|
+ }else{
|
|
|
+ GifTexDeal.remove(EditOverlay.editPlane.animation)
|
|
|
+ EditOverlay.editPlane.animateInfo = null
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ {//gif动画 input
|
|
|
+
|
|
|
+ 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 += '.')//补小数点
|
|
|
+ }
|
|
|
+ let changeAnimation = function(){
|
|
|
+ GifTexDeal.setRepeart(EditOverlay.editPlane.animation)
|
|
|
+
|
|
|
+ }
|
|
|
+ let restartAnimation = function(){
|
|
|
+ GifTexDeal.stop(EditOverlay.editPlane.animation)
|
|
|
+ GifTexDeal.start(EditOverlay.editPlane.animation)
|
|
|
+ }
|
|
|
+ let changeFrameCount = function(){
|
|
|
+ var a = EditOverlay.editPlane.animateInfo
|
|
|
+ var frameCount = a.cellXcount * a.cellYcount
|
|
|
+ $("#gifFrameCount").text(frameCount)
|
|
|
+ var fps = parseFloat($("#gifFps").val())
|
|
|
+ a.duration = frameCount / fps * 1000
|
|
|
+ $("#gifDuration").val(toPrecision(a.duration/1000, 2))
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ let gifXCountFun = function(value){
|
|
|
+ EditOverlay.editPlane.animateInfo.cellXcount = value
|
|
|
+ var gifImgWidth = parseFloat($("#gifImgWidth").text())
|
|
|
+ var gifCellWidth = toPrecision(gifImgWidth / EditOverlay.editPlane.animateInfo.cellXcount,1);
|
|
|
+ $("#gifCellWidth").val(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){
|
|
|
+ EditOverlay.editPlane.animateInfo.cellYcount = value
|
|
|
+ var gifImgHeight = parseFloat($("#gifImgHeight").text())
|
|
|
+ var gifCellHeight = toPrecision(gifImgHeight / EditOverlay.editPlane.animateInfo.cellYcount,1);
|
|
|
+ $("#gifCellHeight").val(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()
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ let gifDurationFun = function(value){
|
|
|
+ var a = EditOverlay.editPlane.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 = EditOverlay.editPlane.animateInfo
|
|
|
+ let frameCount = a.cellXcount * a.cellYcount
|
|
|
+ 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()
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
|
|
|
},
|
|
@@ -3501,7 +3688,9 @@ var EditOverlay = {
|
|
|
switchEditType : function(type){
|
|
|
this.editType = type;
|
|
|
$('#overlayUpload [name="upload"] button').text(type == 'video' ? "上传视频" : "上传图片")
|
|
|
- $('#overlayUpload .preview span').text(type == 'video' ? "支持MP4、MOV等,<20M" : "支持jpg、png等,<20M");
|
|
|
+ $('#overlayUpload .preview span').eq(0).text(type == 'video' ? "支持MP4、MOV等,<20M" : "支持jpg、png等,<20M");
|
|
|
+ if(type != 'photo' || !this.editPlane) $('#overlayProp #gifEdit').css({display: 'none'})
|
|
|
+
|
|
|
},
|
|
|
beginToAddPlane: function(event) {
|
|
|
this.switchEditType($(event.target).attr("data-type"))
|
|
@@ -3566,26 +3755,17 @@ var EditOverlay = {
|
|
|
});
|
|
|
$('#overlayUpload .preview [attr-type="width"]').text(toPrecision(overlay.width, 2))
|
|
|
$('#overlayUpload .preview [attr-type="height"]').text(toPrecision(overlay.height, 2))
|
|
|
-
|
|
|
+ $("#gifSwitch input").prop('checked', !!overlay.animateInfo);
|
|
|
+ $("#gifInfoEdit").css({display: !!overlay.animateInfo ? 'block' : 'none'})
|
|
|
},
|
|
|
- updateOverlayPanel: function(overlay) {
|
|
|
- this.editPlane = overlay;
|
|
|
- overlay.requestDownload()
|
|
|
-
|
|
|
- if(overlay._loadDones){
|
|
|
- $('.waiting').addClass('showloading');
|
|
|
- overlay._loadDones.push(()=>{
|
|
|
- $('.waiting').removeClass('showloading');
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ updateOverlayPreview : function(overlay){
|
|
|
var plane = overlay.plane
|
|
|
var src = plane.material.map && (plane.material.map.image ? plane.material.map.image.src : overlay.fileSrc );
|
|
|
$('#overlayUpload .preview video').remove();
|
|
|
|
|
|
- overlay.overlayType && this.switchEditType(overlay.overlayType)
|
|
|
+
|
|
|
|
|
|
|
|
|
if (overlay.overlayType == "video") {
|
|
@@ -3595,7 +3775,7 @@ var EditOverlay = {
|
|
|
} else if(overlay.overlayType == "photo" || overlay.overlayType == "text"){
|
|
|
$('#overlayUpload .preview').css({
|
|
|
'background-image': src ? ("url(" + src + ")") : "",
|
|
|
- 'background-size': "contain"
|
|
|
+ 'background-size': "100% 100%"
|
|
|
})
|
|
|
}else{
|
|
|
$('#overlayUpload .preview').css({
|
|
@@ -3612,8 +3792,18 @@ var EditOverlay = {
|
|
|
$('#overlayUpload [name="useImgRatio"]').addClass("hide")
|
|
|
$('#overlayUpload .preview').removeClass('uploaded')
|
|
|
}
|
|
|
-
|
|
|
- this.updateOverlayScaleDisplay()
|
|
|
+ }
|
|
|
+ ,
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ updateOverlayPanel: function(overlay) {
|
|
|
+ overlay.overlayType && this.switchEditType(overlay.overlayType)
|
|
|
+ this.updateOverlayPreview(overlay)
|
|
|
+ this.updateOverlayScaleDisplay()
|
|
|
+ this.updateGifPanel(overlay)
|
|
|
+
|
|
|
+
|
|
|
|
|
|
if (overlay.hasBox) {
|
|
|
this.scroller.videoDepth.setValue(overlay.scale.z * settings.overlay.depth * 100, true)
|
|
@@ -3630,10 +3820,58 @@ var EditOverlay = {
|
|
|
},
|
|
|
|
|
|
//----------------------------
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ updateGifPanel : function(overlay){
|
|
|
+ if(this.editType == 'photo'){
|
|
|
+ if(!overlay.plane.material.map)return;
|
|
|
+ $('#overlayProp #gifEdit').css({display: 'block'})
|
|
|
+
|
|
|
+ let w = overlay.plane.material.map.image.width
|
|
|
+ let h = overlay.plane.material.map.image.height
|
|
|
+ if(overlay.animateInfo){
|
|
|
+ let a = overlay.animateInfo
|
|
|
+ $("#gifXCount").val(a.cellXcount);
|
|
|
+ $("#gifYCount").val(a.cellYcount);
|
|
|
+ $("#gifImgWidth").text(w)
|
|
|
+ $("#gifImgHeight").text(h)
|
|
|
+ $("#gifCellWidth").val(toPrecision(w / a.cellXcount, 2));
|
|
|
+ $("#gifCellHeight").val(toPrecision(h / a.cellYcount, 2));
|
|
|
+ let frameCount = a.cellXcount * a.cellYcount
|
|
|
+ $("#gifFrameCount").text(frameCount)
|
|
|
+ $("#gifDuration").val(toPrecision(a.duration / 1000, 2));
|
|
|
+ $("#gifFps").val(toPrecision(frameCount / a.duration * 1000, 1) );
|
|
|
+ }else{
|
|
|
+ $("#gifXCount").val(1);
|
|
|
+ $("#gifYCount").val(1);
|
|
|
+ $("#gifImgWidth").text(w)
|
|
|
+ $("#gifImgHeight").text(h)
|
|
|
+ $("#gifCellWidth").val(w);
|
|
|
+ $("#gifCellHeight").val(h)
|
|
|
+ $("#gifFrameCount").text(1)
|
|
|
+ $("#gifDuration").val(1);
|
|
|
+ $("#gifFps").val(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ,
|
|
|
+ beginEdit : function(overlay){
|
|
|
+ $('#overlayProp').removeClass('atRight').removeClass('hide')
|
|
|
+ this.endAddPlane();
|
|
|
+ this.editPlane = overlay;
|
|
|
+
|
|
|
+
|
|
|
+ overlay.requestDownload()
|
|
|
+ if(overlay._loadDones){
|
|
|
+ $('.waiting').addClass('showloading');
|
|
|
+ overlay._loadDones.push(()=>{
|
|
|
+ $('.waiting').removeClass('showloading');
|
|
|
+ })
|
|
|
+ }
|
|
|
+ overlay.visible = true
|
|
|
+ this.updateOverlayPanel(overlay)
|
|
|
+ transformControls.attach(overlay)
|
|
|
+ }
|
|
|
+ ,
|
|
|
panoPosSwitchOnChange : function(){
|
|
|
var on = this.panoPosSwitch.is(':checked')
|
|
|
|
|
@@ -3713,7 +3951,7 @@ var EditOverlay = {
|
|
|
if (type == 'cancel') {
|
|
|
if (!this.editPlane.isNew && !this.editPlane.needDelete)
|
|
|
this.editPlane.setFromInfo(this.editPlane.info)
|
|
|
- //this.setOverlayFromInfo(this.editPlane, this.editPlane.info);//恢复
|
|
|
+
|
|
|
else
|
|
|
this.disposeOverlay(this.editPlane);
|
|
|
//删除
|
|
@@ -3759,7 +3997,7 @@ var EditOverlay = {
|
|
|
|
|
|
this.updateScale()
|
|
|
|
|
|
- this.updateOverlayPanel(this.editPlane)
|
|
|
+ this.updateOverlayPreview(this.editPlane)
|
|
|
},
|
|
|
|
|
|
getOverlayInfo: function(overlay) {
|
|
@@ -3787,6 +4025,9 @@ var EditOverlay = {
|
|
|
hasBox: overlay.hasBox,
|
|
|
transformAtPanos: transformAtPanos
|
|
|
}
|
|
|
+ if(overlay.animateInfo ){
|
|
|
+ overlay.info.animateInfo = CloneObject(overlay.animateInfo)
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
getSavingInfo: function(overlay) {
|
|
@@ -3813,8 +4054,13 @@ var EditOverlay = {
|
|
|
hasBox: overlay.hasBox ? 1 : 0,
|
|
|
media: [overlay.overlayType],
|
|
|
file: overlay.fileSrc || overlay.plane.material.map.image.src,
|
|
|
- transformAtPanos : transformAtPanos
|
|
|
+ transformAtPanos : transformAtPanos,
|
|
|
+
|
|
|
+ }
|
|
|
+ if(overlay.animateInfo && overlay.animateInfo.cellXcount * overlay.animateInfo.cellYcount > 1){
|
|
|
+ info.animateInfo = overlay.animateInfo
|
|
|
}
|
|
|
+
|
|
|
|
|
|
return info
|
|
|
|
|
@@ -3867,7 +4113,9 @@ var EditOverlay = {
|
|
|
plane.material.dispose();
|
|
|
overlay.parent.remove(overlay);
|
|
|
this.removeFromList(overlay)
|
|
|
-
|
|
|
+ if(this.animation){
|
|
|
+ GifTexDeal.remove(this.animation)
|
|
|
+ }
|
|
|
//this.beginToAddPlane()
|
|
|
|
|
|
},
|
|
@@ -4897,29 +5145,7 @@ function permitTranMode(state) {
|
|
|
state ? $(".pinBottom.left").removeClass('hide') : $(".pinBottom.left").addClass('hide');
|
|
|
}
|
|
|
|
|
|
-CloneObject = function(copyObj, result, isSimpleCopy) {
|
|
|
- //isSimpleCopy只复制最外层
|
|
|
- //复制json result的可能:普通数字或字符串、普通数组、复杂对象
|
|
|
- result = result || {};
|
|
|
- if (copyObj instanceof Array) {
|
|
|
- if (copyObj[0]instanceof Object) {
|
|
|
- //不支持含有 [[Object]] 这样二级数组里面还是复杂数据的,普通和复杂的数据混合可能也不支持
|
|
|
- console.error("不支持含有 [[Object]] 这样二级数组里面还是复杂数据的...")
|
|
|
- }
|
|
|
- return copyObj.slice(0);
|
|
|
- //如果是数组,直接复制返回(排除数组内是object
|
|
|
- }
|
|
|
- for (var key in copyObj) {
|
|
|
- if (copyObj[key]instanceof Object && !isSimpleCopy)
|
|
|
- result[key] = CloneObject(copyObj[key]);
|
|
|
- else
|
|
|
- result[key] = copyObj[key];
|
|
|
- //如果是函数类同基本数据,即复制引用
|
|
|
- }
|
|
|
- return result;
|
|
|
-}
|
|
|
-;
|
|
|
-
|
|
|
+
|
|
|
function randomWord(randomFlag, min, max) {
|
|
|
//随机字符串
|
|
|
var str = ""
|