Commit 53645390 authored by rockyl's avatar rockyl

提交

parent 1e347450
......@@ -2,8 +2,8 @@
* Created by rockyl on 2019-11-25.
*/
var mergeFlagReg = /__m$/;
var excludeFlagReg = /__e$/;
var mergeFlagReg = /__m/;
var excludeFlagReg = /__e/;
var extName = '.psd';
var oldDocument = app.activeDocument;
......@@ -15,7 +15,12 @@ var document = oldDocument.duplicate(oldDocument.name.replace(extName, '') + '-
function traverse(layer, callback) {
if (layer.layers) {
for (var i = 0, li = layer.layers.length; i < li; i++) {
var childLayer = layer.layers[i];
var childLayer;
try {
childLayer = layer.layers[i];
}catch (e) {
alert('图层[' + layer.name + ']的第' + i + '个子图层存在问题,请先处理掉');
}
var action = callback(childLayer);
switch (action) {
case 0:
......
......@@ -80,7 +80,8 @@
"Saving": "保存中…",
"Divider": "分流节点",
"Custom": "自定义节点",
"Custom event": "自定义事件",
"Custom global event": "自定义全局事件",
"Custom private event": "自定义私有事件",
"Entry": "入口",
"Packing": "打包",
"Type": "类型",
......@@ -108,6 +109,8 @@
"Trigger once": "触发一次",
"Meta Editor": "过程元配置",
"Env editor": "环境编辑器",
"Inline": "内联",
"Common": "通用",
"As inline": "作为内联",
"Project": "项目",
"Check template code": "查看模板代码",
......@@ -157,6 +160,7 @@
"Confirm to exit the editor": "确定退出编辑器吗?",
"Confirm to publish": "确定发布吗?",
"Are you sure to delete this behavior?": "确定删除这个的行为吗",
"Are you sure to delete this process?": "确定删除这个的过程吗",
"Are you sure to delete it's process?": "确定删除行为对应的过程吗",
"Are you sure to delete this asset?": "确定删除这个素材吗",
"Are you sure to combine those assets?": "确定合并这些素材吗",
......@@ -205,7 +209,7 @@
"Index page exists": "已存在首页",
"Please config projectID": "请先配置{env}环境下的projectId",
"Online ticket is invalid": "线上tickct失效,请联系管理员修改",
"Are you sure to translate to normal process?": "你确定将此转化为通用过程吗?",
"Are you sure to transform process?": "你确定将此转化为{inlineType}过程吗?",
"Input custom process name": "请输入自定义过程名称",
"Invalid name": "无效名称",
"eventGroup": {
......
......@@ -92,14 +92,44 @@ export const behaviorStore = {
}
state.drawState.boardScale = Math.max(Math.min(4, scale), 0.1);
},
translateToNormal(state, {meta, parentMeta}) {
meta.isInline = false;
let index = parentMeta.metas.indexOf(meta);
parentMeta.metas.splice(index, 1);
state.processes.push(meta);
switchProcessInlineType(state, {process, parentMeta}) {
let newMeta = process.meta;
const {isInline} = newMeta;
let oldUUID = newMeta.id;
let newUUID = generateUUID();
if (isInline) {
newMeta.id = newUUID;
newMeta.isInline = false;
let index = parentMeta.metas.indexOf(newMeta);
parentMeta.metas.splice(index, 1);
state.processes.push(newMeta);
for (let key in parentMeta.sub) {
let subProcess = parentMeta.sub[key];
if (subProcess.meta === oldUUID) {
subProcess.meta = newUUID;
}
}
} else {
newMeta = clonePureObj(newMeta);
newMeta.id = newUUID;
newMeta.isInline = true;
Vue.set(parentMeta, 'metas', []);
parentMeta.metas.push(newMeta);
process.metaID = newUUID;
}
for (let key in parentMeta.sub) {
let subProcess = parentMeta.sub[key];
console.log(subProcess.meta);
}
this.commit('makeBehaviorDirty');
},
},
getters: {
customProcessMap: state => {
......
......@@ -578,6 +578,9 @@ export const projectStore = {
let index = entries.indexOf(behavior.meta);
if (index >= 0) {
let path = paths.splice(index, 1, null)[0];
if(!path){
continue;
}
path[0] = {
process: behavior,
metaName: path[0].name,
......
.zero-playground-body-center{
position: relative;
width: 750px;
height: 1206px;
margin: 10px auto;
height: 1200px;
// max-height: 1200px;
background-color: transparent;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
......
......@@ -277,6 +277,10 @@ export const styles = {
// 如果是label类型,把fillColor转换为color
cmpSelfProps.color = cmpSelfProps.fillColor;
delete cmpSelfProps.fillColor;
if (cmpSelfProps.italic) { //斜体
delete cmpSelfProps.italic;
cmpSelfProps.fontStyle = 'italic';
}
if (!onlyOpera) {
if (cmpSelfProps.lineType === 'single') {
// word-break: keep-all;white-space: nowrap;
......
......@@ -156,6 +156,14 @@ export default {
},
value: false,
},
italic: {
title: '斜体',
type: 'switch',
props: {
width: 40
},
value: false,
},
fillColor: {
title: '颜色',
type: 'colorPicker',
......
......@@ -50,7 +50,7 @@
},
onClickItem(asset, event) {
this.$emit('click-item', asset);
if (event.metaKey) {
if (event.altKey) {
if (this.isSelected(asset)) {
this.unselectItem(asset);
} else {
......
......@@ -6,7 +6,8 @@
<el-dropdown-item :disabled="!!activeComponent.events[key]" v-for="(item, key) in builtinEvents" :command="key"
:key="key">{{item}}
</el-dropdown-item>
<el-dropdown-item divided command="custom">{{$t('Custom event')}}</el-dropdown-item>
<el-dropdown-item divided command="custom-global">{{$t('Custom global event')}}</el-dropdown-item>
<el-dropdown-item command="custom-private">{{$t('Custom private event')}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden" view-class="trigger-list">
......@@ -14,6 +15,7 @@
<div class="top-bar">
<span class="el-icon-caret-right el-tree-node__expand-icon expanded-arrow"
:class="{expanded: !trigger.collapse}"></span>
<el-icon v-if="trigger.custom" :name="trigger.private ? 's-opportunity' : 's-home'"></el-icon>
<span class="name" @click="toggleCollapse(trigger)">
{{$t('events')[name] || name}}({{trigger.behaviors.length}})
</span>
......@@ -34,9 +36,11 @@
<div v-for="(behavior, index) in trigger.behaviors" class="behavior-item">
<enabled-setter :target="behavior"/>
<span v-if="!getBehavior(behavior)" class="name-field missing-behavior">{{$t('Missing behavior')}}</span>
<input v-else class="name-field name-input" type="text" v-model="getBehavior(behavior).name" @change="onBehaviorNameChange"></input>
<input v-else class="name-field name-input" type="text" v-model="getBehavior(behavior).name"
@change="onBehaviorNameChange"></input>
<el-popconfirm class="delete-button" @onConfirm="deleteBehavior(index, trigger.behaviors)" :title="$t('Are you sure to delete this behavior?')">
<el-popconfirm class="delete-button" @onConfirm="deleteBehavior(index, trigger.behaviors)"
:title="$t('Are you sure to delete this behavior?')">
<el-button slot="reference" icon="el-icon-minus" type="danger" plain circle size="mini"/>
</el-popconfirm>
<el-button icon="el-icon-edit" class="edit-button" type="primary" plain circle size="mini"
......@@ -86,9 +90,17 @@
},
addTrigger(command) {
let trigger = {behaviors: []};
if (command === 'custom') {
trigger.custom = true;
switch (command) {
case 'custom-global':
case 'custom-private':
trigger.custom = true;
break;
}
if (command === 'custom-private') {
trigger.private = true;
}
this.addBehavior(command, trigger.behaviors);
this.$set(this.activeComponent.events, command, trigger);
},
......@@ -151,7 +163,7 @@
editBehavior(behavior, behaviors) {
events.$emit('edit-behavior', [{process: behavior}]);
},
onBehaviorNameChange(){
onBehaviorNameChange() {
this.makeProjectDirty();
},
async deleteBehavior(index, behaviors) {
......
......@@ -24,7 +24,7 @@
<board ref="board"
@select-process-node="onSelectProcessNode"
@edit-process="editProcess"
@translate-to-normal="onTranslateToNormal"
@transform="onClickTransform"
@edit-meta="onEditMeta"/>
</div>
<div class="properties background full-size" splitpanes-min="20" :splitpanes-size="20">
......@@ -153,10 +153,12 @@
}
this.$refs.board.updateProcessNode(meta.id);
},
onTranslateToNormal(meta, parentMeta) {
this.$confirm(this.$t('Are you sure to translate to normal process?'), this.$t('Alert'))
onClickTransform(process, parentMeta) {
const {isInline} = process.meta;
const inlineType = this.$t(isInline ? 'Common' : 'Inline');
this.$confirm(this.$t('Are you sure to transform process?', {inlineType}), this.$t('Alert'))
.then(() => {
this.translateToNormal({meta, parentMeta});
this.switchProcessInlineType({process, parentMeta});
}).catch(e => {
})
},
......@@ -169,7 +171,7 @@
'pushProcessStack',
'popProcessStack',
'setScale',
'translateToNormal',
'switchProcessInlineType',
]),
...mapGetters([
'metaInUse',
......@@ -180,4 +182,4 @@
<style scoped>
</style>
\ No newline at end of file
</style>
......@@ -22,7 +22,7 @@
@edit-meta="onEditMeta"
@dblclick="editSubProcess(process)"
@meta-modified="onProcessMetaModified"
@translate-to-normal="onTranslateToNormal"
@transform="onClickTransform"
/>
</g>
</g>
......@@ -399,8 +399,8 @@
onEditMeta(meta, parentMeta) {
this.$emit('edit-meta', meta, parentMeta);
},
onTranslateToNormal(meta) {
this.$emit('translate-to-normal', meta, this.process.meta);
onClickTransform(process) {
this.$emit('transform', process, this.process.meta);
},
editSubProcess(process) {
if (!process.meta.isDivider && this.editable && (process.meta.type !== 'builtin' || process.meta.sub && Object.keys(process.meta.sub).length > 0)) {
......
......@@ -7,7 +7,11 @@ export default class Process {
this._resolveProcess = resolveProcess;
this._parent = parent;
this._data = data;
this.meta = typeof data.meta === 'string' ? this.resolveMeta(data.meta) : data.meta;
if (typeof data.meta === 'string') {
this.metaID = data.meta;
} else {
this.meta = data.meta;
}
}
get data() {
......@@ -22,6 +26,11 @@ export default class Process {
return this._data.uuid;
}
set metaID(id) {
this._data.meta = id;
this.meta = this.resolveMeta(id);
}
resolveMeta(id) {
let meta = this.meta && this.meta.metas ? this.meta.metas.find(meta => meta.id === id) : null;
if (!meta && this._parent) {
......
......@@ -4,7 +4,7 @@
@mouseenter="onMouseEnter"
@mouseleave="onMouseLeave" @click="onClick" @dblclick="onDblclick">
<div class="top-bar" v-if="meta.id !== 'entry' && editable">
<el-link icon="el-icon-magic-stick" :underline="false" v-if="meta.isInline" @mousedown.stop.prevent @click.stop="onClickTranslate"/>
<el-link icon="el-icon-magic-stick" :underline="false" v-if="meta.type !== 'builtin'" @mousedown.stop.prevent @click.stop="onClickTransform"/>
<el-link icon="el-icon-delete" :underline="false" @mousedown.stop.prevent @click.stop="onClickDelete"/>
<el-link icon="el-icon-edit" :underline="false" v-if="meta.type !== 'builtin' && !meta.isDivider"
@mousedown.stop.prevent @click.stop="onClickEdit"/>
......@@ -249,8 +249,8 @@
this.$emit('down-pin', e, this.data, pin);
}
},
onClickTranslate() {
this.$emit('translate-to-normal', this.meta);
onClickTransform() {
this.$emit('transform', this.process);
},
onClickDelete() {
this.$confirm(this.$t('Are you sure to delete this process?'))
......
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