70
70
<!-- inactive when has not page -->
71
71
<!-- make device size and scale -->
72
72
<!-- bgcolor and text color apply -->
73
- <div id =" mobile" :class =" (data.pages.length < 1?'inactive':'')"
74
- :style =" 'width:'+(display.landscape?display.height:display.width )* display.scale
75
- +'px;height:'+(display.landscape?display.width:display.height ) * display.scale+'px'+
76
- ';background-color:'+(data.project.isDark?'#2e2e2e':data.project.bgColor)
73
+ <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)
77
76
+';color:'+(data.project.isDark?'white':data.project.textColor)+' !important' " >
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" >
77
+
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" >
84
84
<span v-for =" (comp,i) in data.pages[currentPage].children.visual"
85
85
:key =" i" >
86
86
<simulator @dblclick.native =" removeVisual(i)" @click.native =" currentProperties = comp;"
87
87
:type =" comp.type" :properties =" comp" :scale =" display.scale"
88
88
:page =" data.pages[currentPage]" ></simulator >
89
89
</span >
90
- </div >
90
+ </div >
91
91
92
- <drop class =" drop visual" @drop =" onVisualDrop" :accepts-data =" (n) => isVisual(n)" ></drop >
93
- <!-- <drop class="drop any" @drop="onAnyDrop" mode="cut">-->
94
- <!-- <span v-for="(n, index) in anyDropped" :key="index">Dropped : {{n}}, </span>-->
95
- <!-- </drop>-->
92
+ <drop class =" drop visual" @drop =" onVisualDrop" :accepts-data =" (n) => isVisual(n)" ></drop >
93
+ <!-- <drop class="drop any" @drop="onAnyDrop" mode="cut">-->
94
+ <!-- <span v-for="(n, index) in anyDropped" :key="index">Dropped : {{n}}, </span>-->
95
+ <!-- </drop>-->
96
+ </div >
96
97
</div >
97
98
</div >
98
99
</div >
125
126
</h2 >
126
127
<!-- if project init sho properties-->
127
128
<div v-if =" isInitProject" >
128
- <property :properties =" currentProperties" ></property >
129
+ <property :properties =" currentProperties" :page = " data.pages[currentPage] " ></property >
129
130
</div >
130
131
<div v-else class =" text-center" >
131
132
<img src =" ../../assets/img/logo.svg" class =" logo-sm" alt =" " >
137
138
<!-- if project init can pages -->
138
139
<div v-if =" isInitProject" >
139
140
<!-- list of pages -->
140
- <page v-for =" (page,i) in data.pages" :isMain =" data.project.mainPage === i" @click.native =" changePage(i)" :key =" i" :title =" page.name"
141
+ <page v-for =" (page,i) in data.pages" :image =" page.image!= undefined? page.image: null"
142
+ :isMain =" data.project.mainPage === i" @click.native =" changePage(i)" :key =" i" :title =" page.name"
141
143
:active =" currentPage === i" >
142
144
<i class =" fa fa-times" @click =" removePage(i)" ></i >
143
- hello {{ i }}
144
- {{ page.name }}
145
- <!-- ***!*** need screenshot-->
146
145
</page >
147
146
<i class =" fa fa-plus-circle" id =" page-add" @click =" newPage" ></i >
148
147
</div >
@@ -254,16 +253,23 @@ export default {
254
253
removePage : function (i ) { // remove page form project
255
254
var self = this ;
256
255
// confirm before remove
257
- window .alertify .confirm (' Are you sure to remove page?' , ' Remove confirm' , function () {
256
+ window .alertify .confirm (' Are you sure to element page?' , ' Remove confirm' , function () {
258
257
self .data .pages .splice (i, 1 );
259
258
self .changePage (0 );
260
- window .alertify .success (' Page removed' );
259
+ window .alertify .success (' element removed' );
260
+ setTimeout (function () {
261
+ fnc .takeScreenShot (" #preview" , function (e ) {
262
+ self .data .pages [self .currentPage ].image = e;
263
+ self .$forceUpdate ();
264
+ });
265
+ }, 300 );
261
266
}
262
267
, function () {
263
268
window .alertify .error (' Cancel' )
264
269
});
265
270
},
266
271
visualValidator : function (component , visuals ) {
272
+ var self = this ;
267
273
if (component .type === ' appbar' ) {
268
274
// check non duplicate app bar
269
275
for (const comp of visuals) {
@@ -289,11 +295,17 @@ export default {
289
295
do {
290
296
nextName = false ;
291
297
i++ ;
292
- if (names .indexOf (component .type + i .toString ()) > - 1 ) {
298
+ if (names .indexOf (component .type + i .toString ()) > - 1 ) {
293
299
nextName = true ;
294
300
}
295
301
} while (nextName);
296
- visuals[visuals .length - 1 ].name = component .type + i .toString ();
302
+ visuals[visuals .length - 1 ].name = component .type + i .toString ();
303
+
304
+ setTimeout (function () {
305
+ fnc .takeScreenShot (" #preview" , function (e ) {
306
+ self .data .pages [self .currentPage ].image = e;
307
+ });
308
+ }, 1000 );
297
309
return true ;
298
310
},
299
311
onVisualDrop (event ) { // on add a viusal component to page
@@ -415,6 +427,9 @@ export default {
415
427
height : 20vh ;
416
428
border : 1px solid rgba (0 , 0 , 0 , .1 );
417
429
border-right : 0 ;
430
+ overflow-y : scroll ;
431
+ overflow-x : hidden ;
432
+
418
433
}
419
434
420
435
#pages .container {
0 commit comments