-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
155 lines (153 loc) · 7.11 KB
/
index.html
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Editor</title>
</head>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<style>
body {
margin: 0;
}
#toolbar {
position: absolute;
left: 200px;
top: 200px;
background-color: #f1f1f1;
padding: 5px;
border: 1px solid #ddd;
border-radius: 4px;
display: flex; /* Allows horizontal button placement */
}
#grab-handle {
cursor: grab; /* Indicate grab cursor on hover */
width: 20px;
height: 26px;
background-color: #eee;
margin-right: 8px;
user-select: none;
}
#sidebar {
display: flex;
flex-direction: column;
padding-top: 20px;
position: fixed;
top: 0;
right: 0;
/* Set your desired width here */
width: 200px;
/*height: 100vh; */
background-color: #a4a4a4; /* Optional background color */
}
#dropzone {
width: 100%;
height: 100px;
border: 2px solid slategrey;
}
</style>
<body>
<canvas id="canvas"></canvas>
<div id="toolbar">
<div id="grab-handle" class="material-icons">drag_indicator</div>
<button onclick="bringToFront()"><i class="material-icons">keyboard_double_arrow_up</i></button>
<button onclick="bringForward()"><i class="material-icons">keyboard_arrow_up</i></button>
<button onclick="sendToBack()"><i class="material-icons">keyboard_double_arrow_down</i></button>
<button onclick="sendBackwards()"><i class="material-icons">keyboard_arrow_down</i></button>
<button onclick="clone()"><i class="material-icons">control_point_duplicate</i></button>
<button onclick="groupObjects()"><i class="material-icons">join_full</i></button>
<button onclick="ungroupObjects()"><i class="material-icons">join_inner</i></button>
<button onclick="splitImage()"><i class="material-icons">call_split</i></button>
<button onclick="deleteObject()"><i class="material-icons">delete</i></button>
<button onclick="startDepthEstimation()"><i class="material-icons">height</i></button>
<button onclick="startSegmentation()"><i class="material-icons">theater_comedy</i></button>
<button onclick="downloadImage()"><i class="material-icons">save_alt</i></button>
</div>
<div id="sidebar">
<input type="file" id="file-input" />
<div class="add-image-options">
<input type="text" id="imageUrl" placeholder="Paste images or URL">
<button onclick="addImageFromURL()"><i class="material-icons">add_circle_outline</i></button>
<div id="dropzone">Drag and drop images here or</div>
<button type="button" id="selectImageButton">upload image(s)</button>
</div>
<button onclick="clearCanvas()">Clear Canvas</button>
<button onclick="togglePaintMode()"><i class="material-icons">brush</i></button>
<div id="paint-controls" style="display: none">
<label for="brush-size">Brush Size</label><input id="brush-size" type="range" min="1" max="50">
<label for="brush-color">Color</label><input id="brush-color" type="color">
<fieldset id="brush-select">
<legend>Brush type:</legend>
<div>
<input type="radio" id="paint" name="brush" value="paint" checked />
<label for="paint">Paint</label>
</div>
<div>
<input type="radio" id="erase" name="brush" value="erase" />
<label for="erase">Erase</label>
</div>
</fieldset>
</div>
<button onclick="toggleBucketMode()" id="toggle-bucket">Bucket</button>
<div id="bucket-controls" style="display: flex; flex-direction: column">
<label>Threshold
<input type="range" min="0" max="254" value="20" id="bucket-threshold">
</label>
<label>Color
<input type="color" id="bucket-color">
</label>
<label>Alpha
<input type="range" min="0" max="255" value="255" id="bucket-alpha">
</label>
</div>
<textarea id="text-input"></textarea>
<button onclick="addText()">Add Text</button>
<div id="text-menu" style="display: flex; flex-direction: column">
<label for="font-select">Font</label>
<select name="font" id="font-select" oninput="updateText()">
<option value="Times New Roman">Times New Roman</option>
<option value="Arial">Arial</option>
<option value="Courier New">Courier New</option>
<option value="cursive">Cursive</option>
<option value="Impact">Impact</option>
</select>
<label for="align-select">Alignment</label>
<select name="align" id="align-select" oninput="updateText()">
<option value="left">Left</option>
<option value="center">Center</option>
<option value="right">Right</option>
</select>
<label for="lineHeight-select">Line Height</label>
<input name="lineHeight" id="lineHeight-select" type="range" value="1" min="1" max="5" oninput="updateText()">
<label for="fillColor-select">Fill Color</label>
<input name="fillColor" id="fillColor-select" type="color" oninput="updateText()">
<label for="strokeColor-select">Stroke Color</label>
<input name="strokeColor" id="strokeColor-select" type="color" oninput="updateText()">
<label for="strokeWidth-select">Stroke Width</label>
<input name="strokeWidth" id="strokeWidth-select" type="range" min="0" max="10" value="1" oninput="updateText()">
<label for="highlight-enabled">Highlight enabled?</label>
<input type="checkbox" id="highlight-enabled" oninput="updateText()">
<label for="highlightColor-select">Highlight Color</label>
<input name="highlightColor" id="highlightColor-select" type="color" oninput="updateText()">
</div>
<button onclick="runOCR()">Img 2 Txt</button>
<label for="ocr-output">Text from image:</label><textarea style="max-width: 200px" id="ocr-output"></textarea>
</div>
<div id="depthControlPanel" style="position: absolute; display: none;">
<input type="range" id="depthSlider" min="0" max="2550" value="0">
<button onclick="confirmDepth()">Confirm</button>
</div>
<div id="segment-controls" style="position: absolute; display: none">
<button id="confirm-segment" onclick="confirmSegmentation()">Confirm</button>
<button id="switch-selecting" onclick="switchSegmentationMode()">Selecting</button>
<button id="remove-point" disabled>Delete last point</button>
<button onclick="reverseMask()">Reverse mask</button>
</div>
</body>
<script src="fabric.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tesseract.js@5/dist/tesseract.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.min.js"></script>
<script defer src="app.js"></script>
<img src="checker.png" style="display: none">
<dialog style="padding: 18px" id="info-dialog"></dialog>
</html>