@@ -1200,6 +1200,71 @@ <h3>Ready to Design Your Perfect Workspace?</h3>
12001200 .layout-image {
12011201 height : 200px ;
12021202 }
1203+ }
1204+ </ style >
1205+
1206+ < script >
1207+ // Workspace layout functionality
1208+ let isDraggingComponent = false ;
1209+ let isResizingComponent = false ;
1210+ let activeComponent = null ;
1211+ let dragStartX , dragStartY , resizeStartWidth , resizeStartHeight , dragStartLeft , dragStartTop ;
1212+
1213+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
1214+ const components = document . querySelectorAll ( '.office-component' ) ;
1215+
1216+ components . forEach ( component => {
1217+ // Dragging functionality
1218+ component . addEventListener ( 'mousedown' , startComponentDrag ) ;
1219+
1220+ // Resizing functionality
1221+ const resizeCorner = component . querySelector ( '.resize-corner' ) ;
1222+ resizeCorner . addEventListener ( 'mousedown' , startComponentResize ) ;
1223+ } ) ;
1224+
1225+ document . addEventListener ( 'mousemove' , handleComponentMouseMove ) ;
1226+ document . addEventListener ( 'mouseup' , stopComponentDragResize ) ;
1227+ } ) ;
1228+
1229+ function startComponentDrag ( e ) {
1230+ if ( e . target . classList . contains ( 'resize-corner' ) ) return ;
1231+
1232+ isDraggingComponent = true ;
1233+ activeComponent = e . currentTarget ;
1234+ activeComponent . classList . add ( 'dragging' ) ;
1235+
1236+ const rect = activeComponent . getBoundingClientRect ( ) ;
1237+ const containerRect = activeComponent . parentElement . getBoundingClientRect ( ) ;
1238+
1239+ dragStartX = e . clientX ;
1240+ dragStartY = e . clientY ;
1241+ dragStartLeft = rect . left - containerRect . left ;
1242+ dragStartTop = rect . top - containerRect . top ;
1243+
1244+ e . preventDefault ( ) ;
1245+ }
1246+
1247+ function startComponentResize ( e ) {
1248+ isResizingComponent = true ;
1249+ activeComponent = e . target . parentElement ;
1250+
1251+ const rect = activeComponent . getBoundingClientRect ( ) ;
1252+
1253+ dragStartX = e . clientX ;
1254+ dragStartY = e . clientY ;
1255+ resizeStartWidth = rect . width ;
1256+ resizeStartHeight = rect . height ;
1257+
1258+ e . preventDefault ( ) ;
1259+ e . stopPropagation ( ) ;
1260+ }
1261+
1262+ function handleComponentMouseMove ( e ) {
1263+ if ( ! isDraggingComponent && ! isResizingComponent ) return ;
1264+
1265+ if ( isDraggingComponent ) {
1266+ const deltaX = e . clientX - dragStartX ;
1267+ const deltaY = e . clientY - dragStartY ;
12031268
12041269 . layout - details {
12051270 padding : 20 px ;
@@ -1208,6 +1273,7 @@ <h3>Ready to Design Your Perfect Workspace?</h3>
12081273 . layout - cta h3 {
12091274 font - size : 1.8 rem ;
12101275 }
1276+ }
12111277
12121278 . layout - cta p {
12131279 font - size : 1.1 rem ;
0 commit comments