9-Slice Extend Problem

Hi guys,

As per bug report case #33001.

The problem occurs on a 9-slice button, where if the height of the rows are not in some order, it will not extend the button properly. Based on my test, the top-row’s height and bottom-row’s height must be nearly the same, or else this problem will occur.

local function f\_testBed15() local widget = require( "widget" ) -- Function to handle button events local function handleButtonEvent( event ) if ( "ended" == event.phase ) then print( "Button was pressed and released" ) end end -- Image sheet options and declaration local topHeight1 = 90 local midHeight1 = 5 local botHeight1 = 15 local width1 = 50 local width2 = 300 local width3 = 50 local col1XPosition = 0 local col2XPosition = col1XPosition + width1 local col3Xposition = col1XPosition + width1 + width2 local row1YPosition = 0 local row2YPosition = row1YPosition + topHeight1 local row3YPosition = row1YPosition + topHeight1 + midHeight1 local options = { frames = { -- TOP { x=col1XPosition, y=row1YPosition, width=width1, height=topHeight1 }, { x=col2XPosition, y=row1YPosition, width=width2, height=topHeight1 }, { x=col3Xposition, y=row1YPosition, width=width3, height=topHeight1 }, -- MIDDLE { x=col1XPosition, y=row2YPosition, width=width1, height=midHeight1 }, { x=col2XPosition, y=row2YPosition, width=width2, height=midHeight1 }, { x=col3Xposition, y=row2YPosition, width=width3, height=midHeight1 }, -- BOTTOM { x=col1XPosition, y=row3YPosition, width=width1, height=botHeight1 }, { x=col2XPosition, y=row3YPosition, width=width2, height=botHeight1 }, { x=col3Xposition, y=row3YPosition, width=width3, height=botHeight1 }, -- Over -- TOP { x=col1XPosition, y=row1YPosition, width=width1, height=topHeight1 }, { x=col2XPosition, y=row1YPosition, width=width2, height=topHeight1 }, { x=col3Xposition, y=row1YPosition, width=width3, height=topHeight1 }, -- MIDDLE { x=col1XPosition, y=row2YPosition, width=width1, height=midHeight1 }, { x=col2XPosition, y=row2YPosition, width=width2, height=midHeight1 }, { x=col3Xposition, y=row2YPosition, width=width3, height=midHeight1 }, -- BOTTOM { x=col1XPosition, y=row3YPosition, width=width1, height=botHeight1 }, { x=col2XPosition, y=row3YPosition, width=width2, height=botHeight1 }, { x=col3Xposition, y=row3YPosition, width=width3, height=botHeight1 }, }, sheetContentWidth = 400, sheetContentHeight = 120, } local buttonSheet = graphics.newImageSheet( "buttonsheet\_v2.png", options ) -- Create the widget local button1 = widget.newButton { width = 200, height = 250, sheet = buttonSheet, topLeftFrame = 1, topMiddleFrame = 2, topRightFrame = 3, middleLeftFrame = 4, middleFrame = 5, middleRightFrame = 6, bottomLeftFrame = 7, bottomMiddleFrame = 8, bottomRightFrame = 9, -- topLeftOverFrame = 10, -- topMiddleOverFrame = 11, -- topRightOverFrame = 12, -- middleLeftOverFrame = 13, -- middleOverFrame = 14, -- middleRightOverFrame = 15, -- bottomLeftOverFrame = 16, -- bottomMiddleOverFrame = 17, -- bottomRightOverFrame = 18, label = "button" } -- Center the button button1.x = display.contentCenterX button1.y = display.contentCenterY -- Change the button's label text button1:setLabel( "9-Slice" ) end