-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathExportExtent.tsx
More file actions
84 lines (79 loc) · 2.33 KB
/
Copy pathExportExtent.tsx
File metadata and controls
84 lines (79 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { useImageExportStore } from '@/GlobalStates/ImageExportStore';
import { useGlobalStore } from '@/GlobalStates/GlobalStore';
import React from 'react'
import { useShallow } from 'zustand/shallow'
export const ExportExtent = React.memo(function ExportExtent(){
const {customRes, previewExtent} = useImageExportStore(useShallow(state=> ({
customRes:state.customRes, previewExtent:state.previewExtent
})))
const dpr = useGlobalStore.getState().DPR || window.devicePixelRatio || 1;
const aspectRatio = customRes[0]/customRes[1]
return (
<div style={{
position:'fixed',
width:`calc(100vh*${aspectRatio})`,
height:`100%`,
left:'50%',
top:'50%',
transform:'translate(-50%, -50%)',
display: previewExtent ? '' : "none",
background:"rgba(200,30,30,0.2)",
zIndex:4
}}
>
{/* Horizontal */}
<div
style={{
position:"absolute",
width: '100%',
top:'50%',
borderTop:'1px solid black',
borderBottom:'1px solid black',
}}
/>
<div
style={{
position:"absolute",
width: '100%',
top:'25%',
borderTop:'1px dashed black',
}}
/>
<div
style={{
position:"absolute",
width: '100%',
top:'75%',
borderBottom:'1px dashed black',
}}
/>
{/* Vertical */}
<div
style={{
position:"absolute",
height: '100%',
left:'50%',
borderLeft:'1px solid black',
borderRight:'1px solid black',
}}
/>
<div
style={{
position:"absolute",
height: '100%',
left:'25%',
borderLeft:'1px dashed black',
}}
/>
<div
style={{
position:"absolute",
height: '100%',
left:'75%',
borderRight:'1px dashed black',
}}
/>
</div>
)
}
)