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

--

parent d9bba829
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
<title>烽火台</title> <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/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> </head>
<body> <body>
......
...@@ -144,6 +144,7 @@ export const projectStore = { ...@@ -144,6 +144,7 @@ export const projectStore = {
this.dispatch('fillLastVersion'); this.dispatch('fillLastVersion');
this.commit('updateAssetDep'); this.commit('updateAssetDep');
state.mockServeEnabled = getMockServeEnabled(id); state.mockServeEnabled = getMockServeEnabled(id);
updateMock(localData.mock); updateMock(localData.mock);
}, },
...@@ -398,14 +399,20 @@ export const projectStore = { ...@@ -398,14 +399,20 @@ export const projectStore = {
} else { } else {
state.data.views.push(child); state.data.views.push(child);
} }
events.$emit("viewReset")
}, },
importView(state, view) { importView(state, view) {
state.data.views.push(view); state.data.views.push(view);
events.$emit("viewReset")
}, },
deleteNode(state, {node, parentNode}) { deleteNode(state, {node, parentNode}) {
const parentChildren = parentNode.children || parentNode; const parentChildren = parentNode.children || parentNode;
const index = parentChildren.indexOf(node); const index = parentChildren.indexOf(node);
parentChildren.splice(index, 1); parentChildren.splice(index, 1);
events.$emit("viewReset")
}, },
copyNode(state, {node, parentNode, copyState}) { copyNode(state, {node, parentNode, copyState}) {
...@@ -432,6 +439,8 @@ export const projectStore = { ...@@ -432,6 +439,8 @@ export const projectStore = {
} }
} }
} }
events.$emit("viewReset")
}, },
...@@ -457,6 +466,8 @@ export const projectStore = { ...@@ -457,6 +466,8 @@ export const projectStore = {
} else { } else {
console.warn("请先选择一个节点进行复制") console.warn("请先选择一个节点进行复制")
} }
events.$emit("viewReset")
}, },
importAssets(state, assets) { importAssets(state, assets) {
state.data.assets.push(...assets); state.data.assets.push(...assets);
......
...@@ -309,6 +309,11 @@ export default { ...@@ -309,6 +309,11 @@ export default {
type: 'boolean', type: 'boolean',
default: false default: false
}, },
mouseChildren: {
alias: '子集交互',
type: 'boolean',
default: false
},
} }
}, },
shape: { shape: {
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
entrySceneView: 'entry', entrySceneView: 'entry',
editorMode: true, editorMode: true,
assetResolver: this.assetResolver, assetResolver: this.assetResolver,
frameRate: 10, frameRate: 30,
}, },
}, null, () => { }, null, () => {
this.onLaunched(); this.onLaunched();
......
...@@ -60,75 +60,76 @@ ...@@ -60,75 +60,76 @@
events.$emit('setMoveEdit', {e,type}); events.$emit('setMoveEdit', {e,type});
}, },
onRuntimeLayerLaunched() { onRuntimeLayerLaunched() {
console.log(this.views[0]) events.$emit("viewReset")
console.log(this.project) },
// this.$refs.runtimeLayer.showView(viewConfig); onSelectNode(nodePath) {
this.$refs.runtimeLayer.showView(this.views[0]); if (!nodePath) {
}, return;
onSelectNode(nodePath) { }
if (!nodePath) { this.nodePath = nodePath;
return; },
} assetResolver(uuid) {
this.nodePath = nodePath; console.log(uuid)
}, let asset = this.project.data.assets.find(a => a.uuid === uuid);
assetResolver(uuid) { let url = asset ? asset.url : '';
console.log(uuid) console.log(url)
let asset = this.project.data.assets.find(a => a.uuid === uuid); return url
let url = asset ? asset.url : ''; },
console.log(url) getNode(type) {
return url if(type=="end"){
}, this.targetNode = this.$refs.runtimeLayer.getNode(this.nodePath);
getNode(type) { console.log("this.targetNode",this.targetNode)
if(type=="end"){ events.$emit('locate-view-node-active', this.targetNode);
}else if(type=="update"){
this.targetNode = this.$refs.runtimeLayer.getNode(this.nodePath); 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 onModifyProp(key,value,type) {
this.getNode("end") 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: { computed: {
...mapGetters(['views']), ...mapGetters(['views']),
...@@ -152,6 +153,9 @@ ...@@ -152,6 +153,9 @@
events.$on('autoSelectState', (data)=>{ events.$on('autoSelectState', (data)=>{
this.autoSelectState=data this.autoSelectState=data
}); });
events.$on("viewReset",()=>{this.$refs.runtimeLayer.showView(this.views[0]);})
}, },
watch: { watch: {
nodePath() { nodePath() {
......
...@@ -67,9 +67,13 @@ export default { ...@@ -67,9 +67,13 @@ export default {
if(!this.canFouce){ if(!this.canFouce){
return false; 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",{ events.$emit("onClickTouchLayer",{
x:e.pageX-this.$refs.zeroPlayground.getBoundingClientRect().left/2, x:e.pageX-this.$refs.zeroPlayground.getBoundingClientRect().left/this.zoom,
y:e.pageY-this.$refs.zeroPlayground.getBoundingClientRect().top/2 y:e.pageY-this.$refs.zeroPlayground.getBoundingClientRect().top/this.zoom
}); });
}, },
matrixToGroup(matrix) { 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