Skip to content

Scroller Min and Max Position - #6

Open
martinruenz wants to merge 1 commit into
jesses:masterfrom
martinruenz:master
Open

Scroller Min and Max Position #6
martinruenz wants to merge 1 commit into
jesses:masterfrom
martinruenz:master

Conversation

@martinruenz

Copy link
Copy Markdown

In many scenarios (e.g. Jump 'n' Run games) it's important to set min and max values to the x,y coordinates of scrollers. This functionality is added now.

… coordinates of a scroller. This functionality is added now.
Comment thread misc/Scroller.as

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (trivial code) is new:

[Inspectable(defaultValue=false)]
public var useMinMax:Boolean = false;

[Inspectable(defaultValue=0)]
public var xMin:Number = 0;
[Inspectable(defaultValue=0)]
public var xMax:Number = 0;

[Inspectable(defaultValue=0)]
public var yMin:Number = 0;
[Inspectable(defaultValue=0)]
public var yMax:Number = 0;

[...]

if (useMinMax)
  {
    if (this.x < xMin)
      this.x = xMin;

    if (this.x > xMax)
      this.x = xMax;

    if (this.y < yMin)
      this.y = yMin;

    if (this.y > yMax)
      this.y = yMax;
  }

@blachniet

Copy link
Copy Markdown

This is definitely a useful feature. I also think it should be pulled into the mainline.

@ypmits

ypmits commented Apr 28, 2012

Copy link
Copy Markdown

Good feature, implemented it straight away. :) Thanx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants