Skip to content

solar2d/io.joehinkle-plugin.embeddablescrollview

Repository files navigation

Solar2D Embeddable ScrollView

Overview

When you put Solar2D's widget.newScrollView inside of another widget.newScrollView, there is some funky behavior. This plugin allows you to fix that by using embeddableScrollview.create.

Demo Video

https://www.youtube.com/watch?v=04L_njW_MjM

Add following to your build.settings to use:

{
    plugins = {
        ["plugin.embeddablescrollview"] = {
            publisherId = "io.joehinkle",
        },
    },
}

Use

Import

lua local embeddableScrollview = require "plugin.embeddablescrollview"

Extra Options

With an embedded scrollview you get a few extra parameters added to the built-in scrollview:

  • displayObjectToGiveTouchFocusFromHorizontalScroll
  • displayObjectToGiveTouchFocusFromVerticalScroll
  • displayObjectToGiveTouchFocusFromFunctionCall

Scrollview, but gives aways horizontal scrolls

myEmbeddedScrollView = embeddableScrollview.create({
    ...
    displayObjectToGiveTouchFocusFromHorizontalScroll = parentScrollView,
    ...
})

Scrollview, but gives aways vertical scrolls

myEmbeddedScrollView = embeddableScrollview.create({
    ...
    displayObjectToGiveTouchFocusFromVerticalScroll = parentScrollView,
    ...
})

Scrollview, but can manually give away

myEmbeddedScrollView = embeddableScrollview.create({
    ...
    displayObjectToGiveTouchFocusFromFunctionCall = parentScrollView,
    ...
})
-- somewhere later in code
myEmbeddedScrollView:giveFocusAway() -- gives it to whatever was set in as displayObjectToGiveTouchFocusFromFunctionCall

Links

Shameless plugs