1212 <!-- Bootstrap Icons -->
1313 < link rel ="stylesheet " href ="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css ">
1414 < style >
15+ /* Resizable modal CSS */
16+ /* .modal.show {
17+ display: block !important;
18+ align-items: unset !important;
19+ }
20+ .modal-dialog {
21+ width: auto !important;
22+ height: auto !important;
23+ display: block !important;
24+ }
25+ .resizable-modal-content {
26+ resize: both;
27+ overflow: auto;
28+ min-width: 400px;
29+ min-height: 200px;
30+ max-width: 90vw;
31+ max-height: 90vh;
32+ } */
1533 .material-card {
1634 transition : transform 0.2s ;
1735 cursor : pointer;
7391 < a class ="navbar-brand d-flex align-items-center " href ="# ">
7492 < img class ="px-1 "
7593 src ="https://raw.githubusercontent.com/kwokcb/materialxMaterials/refs/heads/main/documents/images/download.png "
94+ loading ="lazy " decoding ="async "
7695 width ="48px " alt ="MaterialX Materials Icon ">
7796 < span class ="ms-2 "> Poly Haven MaterialX Materials</ span >
7897 </ a >
130149
131150 <!-- Material Preview Modal -->
132151 < div class ="modal fade " id ="materialModal " tabindex ="-1 " aria-labelledby ="materialModalLabel " aria-hidden ="true ">
133- < div class ="modal-dialog modal-lg ">
134- < div class ="modal-content ">
135- < div class ="modal-header ">
152+ < div class ="modal-dialog modal-lg " id =" materialModalDialog " >
153+ < div class ="modal-content resizable-modal-content ">
154+ < div class ="modal-header " id =" materialModalHeader " >
136155 < h5 class ="modal-title " id ="materialModalLabel "> Material Details</ h5 >
137156 < button type ="button " class ="btn-close " data-bs-dismiss ="modal " aria-label ="Close "> </ button >
138157 </ div >
139158 < div class ="modal-body " style ="font-size: 11px ">
140159 < div class ="row ">
141160 < div class ="col-md ">
142- < img src ="" alt ="Material Preview " class ="img-fluid rounded mb-2 " id ="materialPreview ">
161+ < img src ="" alt ="Material Preview " class ="img-fluid rounded mb-2 " id ="materialPreview " loading =" lazy " decoding =" async " >
143162 < div id ="materialTags " class ="mb-2 "> </ div >
144163 < div id ="materialCategories " class ="mb-2 "> </ div >
145164 </ div >
@@ -196,6 +215,52 @@ <h5 class="modal-title" id="materialModalLabel">Material Details</h5>
196215 < script src ="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/mode/xml/xml.min.js "> </ script >
197216 < script src ="jsPolyHavenLoader.js "> </ script >
198217 < script src ="main.js "> </ script >
218+ < script >
219+ // Make modal movable by dragging header
220+ /*
221+ (function() {
222+ const dialog = document.getElementById('materialModalDialog');
223+ const header = document.getElementById('materialModalHeader');
224+ let isDragging = false;
225+ let startX, startY, startLeft, startTop;
226+
227+ header.style.cursor = 'move';
228+
229+ header.addEventListener('mousedown', function(e) {
230+ isDragging = true;
231+ startX = e.clientX;
232+ startY = e.clientY;
233+ const rect = dialog.getBoundingClientRect();
234+ startLeft = rect.left;
235+ startTop = rect.top;
236+ document.body.style.userSelect = 'none';
237+ });
238+
239+ document.addEventListener('mousemove', function(e) {
240+ if (!isDragging) return;
241+ const dx = e.clientX - startX;
242+ const dy = e.clientY - startY;
243+ dialog.style.position = 'fixed';
244+ dialog.style.left = (startLeft + dx) + 'px';
245+ dialog.style.top = (startTop + dy) + 'px';
246+ dialog.style.margin = 0;
247+ });
248+
249+ document.addEventListener('mouseup', function() {
250+ isDragging = false;
251+ document.body.style.userSelect = '';
252+ });
253+
254+ // Reset position when modal is closed
255+ document.getElementById('materialModal').addEventListener('hidden.bs.modal', function() {
256+ dialog.style.left = '';
257+ dialog.style.top = '';
258+ dialog.style.position = '';
259+ dialog.style.margin = '';
260+ });
261+ })();
262+ */
263+ </ script >
199264</ body >
200265
201266</ html >
0 commit comments