@@ -264,24 +264,35 @@ const Cards = props => {
264
264
265
265
if ( activeDeckId === null ) return ;
266
266
267
+ // Tutorial cards need to calculate their own dragging bounds
268
+ // to allow for dragging the cards off the left, right and bottom
269
+ // edges of the workspace, used in the custom overlay 'card-container-overlay'
270
+ const cardHorizontalOffset = 400 ; // 80% of approx. card width
271
+ const cardVerticalOffset = 256 ; // 80% of approx. card height
272
+ const menuBarHeight = 48 ; // TODO: get pre-calculated from elsewhere?
273
+
267
274
if ( x === 0 && y === 0 ) {
268
275
// initialize positions
269
276
x = isRtl ? - 292 : 292 ;
270
- // The tallest cards are about 385px high, and the default position is pinned
277
+ x += cardHorizontalOffset ;
278
+ // The tallest cards are about 320px high, and the default position is pinned
271
279
// to near the bottom of the blocks palette to allow room to work above.
272
- const tallCardHeight = 385 ;
280
+ const tallCardHeight = 320 ;
273
281
const bottomMargin = 60 ; // To avoid overlapping the backpack region
274
- y = window . innerHeight - tallCardHeight - bottomMargin ;
282
+ y = window . innerHeight - tallCardHeight - bottomMargin - menuBarHeight ;
275
283
}
276
284
277
285
const steps = content [ activeDeckId ] . steps ;
278
286
279
287
return (
288
+ // Use a custom overlay to act as the bounding parent for the draggable
280
289
< div
281
290
className = { styles . cardContainerOverlay }
282
291
style = { {
283
- width : `${ window . innerWidth + ( 2 * 300 ) } px` ,
284
- height : `${ window . innerHeight + ( 2 * 300 ) } px`
292
+ width : `${ window . innerWidth + ( 2 * cardHorizontalOffset ) } px` ,
293
+ height : `${ window . innerHeight - menuBarHeight + cardVerticalOffset } px` ,
294
+ top : `${ menuBarHeight } px` ,
295
+ left : `${ - cardHorizontalOffset } px`
285
296
} }
286
297
>
287
298
< Draggable
0 commit comments