Commit d15af854 authored by 任建锋's avatar 任建锋

--

parent d9bba829
......@@ -8,7 +8,8 @@
<title>烽火台</title>
<script src="//yun.duiba.com.cn/js-libs/psd.js/3.2.0/psd.min.js"></script>
<script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.c70c23ccac5955f9f2cd400fda1e6bba2fb413a3.js"></script>
<script src="http://127.0.0.1:8081/debug/engine.js"></script>
<script src="http://127.0.0.1:8083/debug/engine-svga.js"></script>
</head>
<body>
......
......@@ -144,6 +144,7 @@ export const projectStore = {
this.dispatch('fillLastVersion');
this.commit('updateAssetDep');
state.mockServeEnabled = getMockServeEnabled(id);
updateMock(localData.mock);
},
......@@ -398,14 +399,20 @@ export const projectStore = {
} else {
state.data.views.push(child);
}
events.$emit("viewReset")
},
importView(state, view) {
state.data.views.push(view);
events.$emit("viewReset")
},
deleteNode(state, {node, parentNode}) {
const parentChildren = parentNode.children || parentNode;
const index = parentChildren.indexOf(node);
parentChildren.splice(index, 1);
events.$emit("viewReset")
},
copyNode(state, {node, parentNode, copyState}) {
......@@ -432,6 +439,8 @@ export const projectStore = {
}
}
}
events.$emit("viewReset")
},
......@@ -457,6 +466,8 @@ export const projectStore = {
} else {
console.warn("请先选择一个节点进行复制")
}
events.$emit("viewReset")
},
importAssets(state, assets) {
state.data.assets.push(...assets);
......
......@@ -309,6 +309,11 @@ export default {
type: 'boolean',
default: false
},
mouseChildren: {
alias: '子集交互',
type: 'boolean',
default: false
},
}
},
shape: {
......
......@@ -52,7 +52,7 @@
entrySceneView: 'entry',
editorMode: true,
assetResolver: this.assetResolver,
frameRate: 10,
frameRate: 30,
},
}, null, () => {
this.onLaunched();
......
......@@ -60,75 +60,76 @@
events.$emit('setMoveEdit', {e,type});
},
onRuntimeLayerLaunched() {
console.log(this.views[0])
console.log(this.project)
// this.$refs.runtimeLayer.showView(viewConfig);
this.$refs.runtimeLayer.showView(this.views[0]);
},
onSelectNode(nodePath) {
if (!nodePath) {
return;
}
this.nodePath = nodePath;
},
assetResolver(uuid) {
console.log(uuid)
let asset = this.project.data.assets.find(a => a.uuid === uuid);
let url = asset ? asset.url : '';
console.log(url)
return url
},
getNode(type) {
if(type=="end"){
events.$emit("viewReset")
},
onSelectNode(nodePath) {
if (!nodePath) {
return;
}
this.nodePath = nodePath;
},
assetResolver(uuid) {
console.log(uuid)
let asset = this.project.data.assets.find(a => a.uuid === uuid);
let url = asset ? asset.url : '';
console.log(url)
return url
},
getNode(type) {
if(type=="end"){
this.targetNode = this.$refs.runtimeLayer.getNode(this.nodePath);
console.log("this.targetNode",this.targetNode)
events.$emit('locate-view-node-active', this.targetNode);
}else if(type=="update"){
this.targetNode = this.$refs.runtimeLayer.getNode(this.nodePath);
console.log("this.targetNode",this.targetNode)
events.$emit('locate-view-node-active', this.targetNode);
}else if(type=="update"){
this.targetNode = this.$refs.runtimeLayer.getNode(this.nodePath);
}
},
onModifyProp(key,value,type) {
console.log("修改 key v")
if(this.$refs.runtimeLayer){
this.$refs.runtimeLayer.modifyProps(this.nodePath, {
[key]: value,
}, () => {
this.getNode(type);
})
}
},
onClickTouchLayer(e){
const {x,y} = e;
if(!this.autoSelectState){
return false;
}
console.log("sdsd",x/this.zoom,y/this.zoom)
// setTimeout(()=>{
if(this.$refs.runtimeLayer){
this.nodePath = this.$refs.runtimeLayer.getNodePathWithPos({x:x/this.zoom, y:y/this.zoom});
}
// },100)
console.log(this.nodePath)
},
canvasKeyVupdate(data,type){
console.log(10,data)
let _data=data;
for(let item in _data.props){
console.log(item)
if(_data.props.hasOwnProperty(item)){
console.log(_data.props[item])
this.onModifyProp(item, _data.props[item],type)
}
}
},
canvasViewUpdate(){
console.log("视图更新")
this.$refs.runtimeLayer.showView(this.views[0]);
}
,canvasActiveNodeByTree(nodePath){
this.nodePath=nodePath
this.getNode("end")
},
onModifyProp(key,value,type) {
console.log("修改 key v")
if(key=="source"||key=="autoPlay"){
events.$emit("viewReset")
}
if(this.$refs.runtimeLayer){
this.$refs.runtimeLayer.modifyProps(this.nodePath, {
[key]: value,
}, () => {
this.getNode(type);
})
}
},
onClickTouchLayer(e){
const {x,y} = e;
if(!this.autoSelectState){
return false;
}
console.log("sdsd",{x:x/this.zoom, y:y/this.zoom})
console.log("sdsd",x,y)
// setTimeout(()=>{
if(this.$refs.runtimeLayer){
this.nodePath = this.$refs.runtimeLayer.getNodePathWithPos({x:x/this.zoom, y:y/this.zoom});
}
// },100)
console.log(this.nodePath)
},
canvasKeyVupdate(data,type){
console.log(10,data)
let _data=data;
for(let item in _data.props){
console.log(item)
if(_data.props.hasOwnProperty(item)){
console.log(_data.props[item])
this.onModifyProp(item, _data.props[item],type)
}
}
},
canvasViewUpdate(){
console.log("视图更新")
this.$refs.runtimeLayer.showView(this.views[0]);
}
,canvasActiveNodeByTree(nodePath){
this.nodePath=nodePath
this.getNode("end")
}
},
computed: {
...mapGetters(['views']),
......@@ -152,6 +153,9 @@
events.$on('autoSelectState', (data)=>{
this.autoSelectState=data
});
events.$on("viewReset",()=>{this.$refs.runtimeLayer.showView(this.views[0]);})
},
watch: {
nodePath() {
......
......@@ -67,9 +67,13 @@ export default {
if(!this.canFouce){
return false;
}
// console.log(e,this.$refs.zeroPlayground.getBoundingClientRect())
// console.log(e.offsetX,this.$refs.zeroPlayground.getBoundingClientRect())
// console.log(e.pageX,this.$refs.zeroPlayground.getBoundingClientRect())
// console.log(e.pageX-(this.$refs.zeroPlayground.getBoundingClientRect().left/this.zoom))
events.$emit("onClickTouchLayer",{
x:e.pageX-this.$refs.zeroPlayground.getBoundingClientRect().left/2,
y:e.pageY-this.$refs.zeroPlayground.getBoundingClientRect().top/2
x:e.pageX-this.$refs.zeroPlayground.getBoundingClientRect().left/this.zoom,
y:e.pageY-this.$refs.zeroPlayground.getBoundingClientRect().top/this.zoom
});
},
matrixToGroup(matrix) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment