shbatm / MMM-Carousel

Displays a single magic mirror module at a time, rotating through the list of configured modules in a carousel-like fashion.
MIT License
40 stars 13 forks source link

Only the first carouselId is displayed on a slide for a unique module. #36

Open paulsp opened 2 years ago

paulsp commented 2 years ago
slides: [ [
               {name:'MMM-SimpleText', carouselId: '1.3'},
               {name:'MMM-SimpleText', carouselId: '1.4'},
               ]
             ]

Will only display carouselId: '1.3'. If the break is change to continue both 1.3 and 1.4 will be displayed.

https://github.com/shbatm/MMM-Carousel/blob/22b64b2aa686b6d3c1972aef770be64082dd5f89/MMM-Carousel.js#L363-L369

shbatm commented 2 years ago

Related to #34

paulsp commented 2 years ago

The following config.js snipit works as expected with the above mentioned fix.

    modules: [
        {
            module: 'helloworld',
            position: 'center_middle',
            config: {
                carouselId: 'section-1-header',
                text: 'Section 1'
            }
        },
        {
            module: 'helloworld',
            position: 'center_middle',
            config: {
                carouselId: 'section-1-detail',
                text: 'Detail Line 1.1'
            }
        },
        {
            module: 'helloworld',
            position: 'center_middle',
            config: {
                carouselId: 'section-1-detail',
            position: 'center_middle',
            config: {
                carouselId: 'section-1-detail',
                text: 'Detail Line 1.2'
            }
        },
        {
            module: 'helloworld',
            position: 'center_middle',
            config: {
                carouselId: 'section-2-header',
                text: 'Section 2'
            }
        },
        {
            module: 'helloworld',
            position: 'center_middle',
            config: {
                carouselId: 'section-2-detail',
                text: 'Detail Line 2.1'
            }
        },
        {
            module: 'helloworld',
            position: 'center_middle',
            config: {
                carouselId: 'section-2-detail',
                text: 'Detail Line 2.2'
            }
        },
        {
            module: 'MMM-Carousel',
            position: 'bottom_bar',
            config: {
                mode: 'slides',
                slides: [
                        [
                        {name:'helloworld', carouselId: 'section-1-header'}, // Expect 1 line
                        {name:'helloworld', carouselId: 'section-1-detail'}, // Expect 2 lines
                        {name:'helloworld', carouselId: 'section-2-header'}, // Expect 1 line
                        {name:'helloworld', carouselId: 'section-2-detail'}, // Expect 2 lines
                        {name:'helloworld', carouselId: 'section-2-detail'}, // Expect zero lines as duplicate carouselId in slide
                        {name:'helloworld', carouselId: 'section-2-detail'}, // Expect zero lines as duplicate carouselId in slide
                        {name:'helloworld', carouselId: 'section-3-header'}, // Expect zero lines as carouselId not defined
                        {name:'helloworld', carouselId: 'section-3-detail'}, // Expect zero lines as carouselId not defined
                        ]
                ]
            }
        }
    ]
asgillmor commented 1 year ago

the fix on line 368 seemed to work for me