|
@@ -3,10 +3,11 @@ import { CompObject } from "@/modules/editor/controllers/SelectCtrl/compObj";
|
|
|
import { css } from "@linaria/core";
|
|
|
import { IconDelete } from "@queenjs/icons";
|
|
|
import { defineComponent, onMounted, ref } from "vue";
|
|
|
-import { string ,bool} from "vue-types";
|
|
|
+import { string, bool } from "vue-types";
|
|
|
import { useEditor } from "../../..";
|
|
|
-import { useCompRef , useCompEditLayerRef} from "./hooks";
|
|
|
+import { useCompRef, useCompEditLayerRef } from "./hooks";
|
|
|
import { DesignComp } from "@/modules/editor/objects/DesignTemp/DesignComp";
|
|
|
+import { Design_Page_Size } from "@/modules/editor/dicts/CompOptions";
|
|
|
|
|
|
export const View = defineComponent({
|
|
|
props: {
|
|
@@ -17,7 +18,9 @@ export const View = defineComponent({
|
|
|
setup(props, { slots, emit }) {
|
|
|
const { store, actions, helper, controls } = useEditor();
|
|
|
const compRef = useCompRef(props.compId);
|
|
|
- const editorLayerRef = props.editlayer? useCompEditLayerRef(props.compId) : ref();
|
|
|
+ const editorLayerRef = props.editlayer
|
|
|
+ ? useCompEditLayerRef(props.compId)
|
|
|
+ : ref();
|
|
|
|
|
|
return () => {
|
|
|
const comp = helper.findComp(props.compId);
|
|
@@ -30,18 +33,23 @@ export const View = defineComponent({
|
|
|
const m = obj.worldTransform.clone();
|
|
|
m.invert();
|
|
|
|
|
|
- let isFocus = store.isEditMode && store.selected.length > 1 && store.lastSelected == props.compId;
|
|
|
+ let isFocus =
|
|
|
+ store.isEditMode &&
|
|
|
+ store.selected.length > 1 &&
|
|
|
+ store.lastSelected == props.compId;
|
|
|
isFocus = isFocus || store.currCompId == props.compId;
|
|
|
-
|
|
|
+
|
|
|
const style = helper.createStyle(comp.layout, comp);
|
|
|
const page = helper.findRootComp() as DesignComp;
|
|
|
|
|
|
- if (isStreamCard && page.value.pageMode == "short" && store.isPreview) {
|
|
|
+ if (isStreamCard && page.value.pageMode == "short" && store.isDisplay) {
|
|
|
// const cards = store.streamCardIds;
|
|
|
// const index = cards.indexOf(props.compId)
|
|
|
// style.position = "absolute";
|
|
|
// style.top = index * 100 + "vh";
|
|
|
- style.height = "100vh"
|
|
|
+ style.height = helper.designToNaturalSize(Design_Page_Size[1], {
|
|
|
+ adaptiveH: true,
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
if (comp.anim && comp.anim.transition) {
|
|
@@ -53,10 +61,12 @@ export const View = defineComponent({
|
|
|
ref={compRef}
|
|
|
class={[
|
|
|
viewStyle,
|
|
|
- store.isEditMode && controls.selectCtrl._state != 0 && editCompStyle,
|
|
|
+ store.isEditMode &&
|
|
|
+ controls.selectCtrl._state != 0 &&
|
|
|
+ editCompStyle,
|
|
|
isGroupComp && groupCompCls,
|
|
|
store.currStreamCardId == props.compId && CurrCompStyle,
|
|
|
- isFocus && AnchorCompStyle
|
|
|
+ isFocus && AnchorCompStyle,
|
|
|
]}
|
|
|
style={style}
|
|
|
onClick={(e) => {
|
|
@@ -81,13 +91,15 @@ export const View = defineComponent({
|
|
|
{slots.default?.()}
|
|
|
</div>
|
|
|
|
|
|
- {store.isEditMode && isStreamCard && store.currStreamCardId == props.compId && <Hudop compId={props.compId} />}
|
|
|
+ {store.isEditMode &&
|
|
|
+ isStreamCard &&
|
|
|
+ store.currStreamCardId == props.compId && (
|
|
|
+ <Hudop compId={props.compId} />
|
|
|
+ )}
|
|
|
|
|
|
- {
|
|
|
- store.isEditMode && props.editlayer && <div ref={editorLayerRef} class={editAreaStyle}>
|
|
|
-
|
|
|
- </div>
|
|
|
- }
|
|
|
+ {store.isEditMode && props.editlayer && (
|
|
|
+ <div ref={editorLayerRef} class={editAreaStyle}></div>
|
|
|
+ )}
|
|
|
</div>
|
|
|
);
|
|
|
};
|
|
@@ -192,13 +204,13 @@ const editAreaStyle = css`
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
pointer-events: none;
|
|
|
-`
|
|
|
+`;
|
|
|
|
|
|
const editAreaTestStyle = css`
|
|
|
- position: absolute;
|
|
|
- top: 0;
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
left: 0;
|
|
|
width: 100px;
|
|
|
height: 100px;
|
|
|
background-color: red;
|
|
|
-`
|
|
|
+`;
|