lib/widgets/blocks.js
// Handles logic of a simple dropping of a block on another
Handles logic of a simple dropping of a block on another
Handles logic of a simple dropping of a block on another
function dropBlock(droppedBlockDef, targetBlockDef, dropSide) {
    if (dropSide === DropSide.left) {
        return {
            id: uuid_1.v4(),
            items: [droppedBlockDef, targetBlockDef],
            type: "horizontal",
            align: "justify"
        };
    }
    if (dropSide === DropSide.right) {
        return {
            id: uuid_1.v4(),
            items: [targetBlockDef, droppedBlockDef],
            type: "horizontal",
            align: "justify"
        };
    }
    if (dropSide === DropSide.top) {
        return {
            id: uuid_1.v4(),
            items: [droppedBlockDef, targetBlockDef],
            type: "vertical"
        };
    }
    if (dropSide === DropSide.bottom) {
        return {
            id: uuid_1.v4(),
            items: [targetBlockDef, droppedBlockDef],
            type: "vertical"
        };
    }
    throw new Error("Unknown side");
}
function dropBlock ( droppedBlockDef , targetBlockDef , dropSide ) { if ( dropSide === DropSide . left ) { return { id : uuid_1 . v4 ( ) , items : [ droppedBlockDef , targetBlockDef ] , type : "horizontal" , align : "justify" } ; } if ( dropSide === DropSide . right ) { return { id : uuid_1 . v4 ( ) , items : [ targetBlockDef , droppedBlockDef ] , type : "horizontal" , align : "justify" } ; } if ( dropSide === DropSide . top ) { return { id : uuid_1 . v4 ( ) , items : [ droppedBlockDef , targetBlockDef ] , type : "vertical" } ; } if ( dropSide === DropSide . bottom ) { return { id : uuid_1 . v4 ( ) , items : [ targetBlockDef , droppedBlockDef ] , type : "vertical" } ; } throw new Error ( "Unknown side" ) ; }
Handles logic of a simple dropping of a block on another
Handles logic of a simple dropping of a block on another