Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
// Calculate target speed if necessary. if (this._ymouse >= _y && this._ymouse <= _y + _height) { // We're in the _y bounds, so let's check if we're in the active _x area. if (this._xmouse <= deadLeft) // Okay, we're in an active zone on the left. Let's calculate what speed we want to go at. { curSpeedTarget = -(this._xmouse - deadLeft) / deadLeft * maxSpeed; if (curSpeedTarget > maxSpeed) { curSpeedTarget = maxSpeed; // Bounds Checking. } // end if } else if (_root._xmouse >= deadRight) // Okay, we're in an active zone on the right. Let's calculate what speed we want to go at. { curSpeedTarget = -(_root._xmouse - deadRight) / deadLeft * maxSpeed; if (curSpeedTarget < -maxSpeed) { curSpeedTarget = -maxSpeed; // Bounds checking. } // end if }
This paste will be private.
From the Design Piracy series on my blog: