Skip to content

Commit f24d7fc

Browse files
committed
fix page preview bug
1 parent 21c964b commit f24d7fc

File tree

4 files changed

+32
-22
lines changed

4 files changed

+32
-22
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "anubias",
3-
"version": "0.2.1",
3+
"version": "0.3.1",
44
"private": true,
55
"description": "anubias desktop application",
66
"author": {

src/components/elements/PageElement.vue

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<!--page symbol for element of list of pages-->
22
<template>
33
<div id="page" :class="active?'active':''">
4-
<div id="page-content">
4+
<div id="page-content" :style="'background:'+bg">
55
<img :src="image !== undefined ? image:''" alt="no preview">
6+
<slot></slot>
67
</div>
78
<h3 id="page-title">
89
<span :class="{main:isMain}">
@@ -19,7 +20,8 @@ export default {
1920
'title',
2021
'active',
2122
'isMain',
22-
'image'
23+
'image',
24+
'bg'
2325
]
2426
}
2527
</script>
@@ -54,7 +56,8 @@ export default {
5456
overflow: hidden;
5557
overflow-y: scroll;
5658
}
57-
#page-content img{
59+
60+
#page-content img {
5861
max-width: 100%;
5962
}
6063

src/components/elements/PropertyElement.vue

+7-6
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,14 @@ import {fnc} from '@/assets/js/functions';
9191
export default {
9292
name: "PropertyElement",
9393
mounted() {
94+
var setme ;
9495
var $ = window.jQuery;
9596
let updatePreview=function () {
96-
setTimeout(function () {
97+
clearTimeout(setme);
98+
setme = setTimeout(function () {
99+
console.log('exet');
97100
fnc.takeScreenShot("#preview",function (e) {
98-
self.page.image = e;
101+
window.appData.pages[self.page].image = e;
99102
});
100103
},300);
101104
};
@@ -118,10 +121,8 @@ export default {
118121
type: Object
119122
},
120123
page: {
121-
default: function () {
122-
return {}
123-
},
124-
type: Object
124+
default:0,
125+
type: Number
125126
}
126127
}, methods: {
127128
nameCheck: function (e, isBlur) {

src/components/pages/MainAppPage.vue

+18-12
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,26 @@
7171
<!-- make device size and scale -->
7272
<!-- bgcolor and text color apply -->
7373
<div id="mobile" :style="'width:'+(display.landscape?display.height:display.width )* display.scale
74-
+'px;height:'+(display.landscape?display.width:display.height ) * display.scale+'px'" :class="(data.pages.length < 1?'inactive':'')">
75-
<div id="preview" :style="';background-color:'+(data.project.isDark?'#2e2e2e':data.project.bgColor)
76-
+';color:'+(data.project.isDark?'white':data.project.textColor)+' !important' ">
74+
+'px;height:'+(display.landscape?display.width:display.height ) * display.scale+'px;'+'background-color:'+(data.project.isDark?'#2e2e2e':data.project.bgColor)
75+
+';color:'+(data.project.isDark?'white':data.project.textColor)+' !important' "
76+
:class="(data.pages.length < 1?'inactive':'')">
7777

78-
<!-- direction of project and page padding -->
79-
<div id="dir"
80-
:style="'direction:'+(data.project.isRTL?'rtl':'ltr')+';padding:'+calcPadding(data.pages[currentPage].padding,this.display.scale)">
81-
<!-- visual components of page -->
82-
<div
83-
v-if="data.pages[currentPage] !== undefined && data.pages[currentPage].children.visual !== undefined">
78+
<div id="preview">
79+
<div :style="'background-color:'+(data.project.isDark?'#2e2e2e':data.project.bgColor)
80+
+';color:'+(data.project.isDark?'white':data.project.textColor)+' !important' ">
81+
<!-- direction of project and page padding -->
82+
<div id="dir"
83+
:style="'direction:'+(data.project.isRTL?'rtl':'ltr')+';padding:'+calcPadding(data.pages[currentPage].padding,this.display.scale)">
84+
<!-- visual components of page -->
85+
<div
86+
v-if="data.pages[currentPage] !== undefined && data.pages[currentPage].children.visual !== undefined">
8487
<span v-for="(comp,i) in data.pages[currentPage].children.visual"
8588
:key="i">
8689
<simulator @dblclick.native="removeVisual(i)" @click.native="currentProperties = comp;"
8790
:type="comp.type" :properties="comp" :scale="display.scale"
8891
:page="data.pages[currentPage]"></simulator>
8992
</span>
93+
</div>
9094
</div>
9195

9296
<drop class="drop visual" @drop="onVisualDrop" :accepts-data="(n) => isVisual(n)"></drop>
@@ -126,7 +130,7 @@
126130
</h2>
127131
<!-- if project init sho properties-->
128132
<div v-if="isInitProject">
129-
<property :properties="currentProperties" :page="data.pages[currentPage]"></property>
133+
<property :properties="currentProperties" :page="currentPage"></property>
130134
</div>
131135
<div v-else class="text-center">
132136
<img src="../../assets/img/logo.svg" class="logo-sm" alt="">
@@ -140,7 +144,7 @@
140144
<!-- list of pages -->
141145
<page v-for="(page,i) in data.pages" :image="page.image!= undefined? page.image: null"
142146
:isMain="data.project.mainPage === i" @click.native="changePage(i)" :key="i" :title="page.name"
143-
:active="currentPage === i">
147+
:active="currentPage === i" :bg="(data.project.isDark?'#2e2e2e':data.project.bgColor)">
144148
<i class="fa fa-times" @click="removePage(i)"></i>
145149
</page>
146150
<i class="fa fa-plus-circle" id="page-add" @click="newPage"></i>
@@ -300,9 +304,10 @@ export default {
300304
}
301305
} while (nextName);
302306
visuals[visuals.length - 1].name = component.type + i.toString();
303-
307+
// update page preview
304308
setTimeout(function () {
305309
fnc.takeScreenShot("#preview", function (e) {
310+
console.log(self.data.pages[self.currentPage].name);
306311
self.data.pages[self.currentPage].image = e;
307312
});
308313
}, 1000);
@@ -443,6 +448,7 @@ export default {
443448
top: 0;
444449
color: red;
445450
font-size: 18px;
451+
z-index: 999;
446452
}
447453
448454
#page-add {

0 commit comments

Comments
 (0)