Thread Tools Display Modes
11/08/15, 11:46 AM   #1
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
[outdated] ScrollControl:SetFadeGradient in any direction

This wish is a little crazy.

* SetFadeGradient(*luaindex* _gradientIndex_, *number* _normalX_, *number* _normalY_, *number* _gradientLength_)

All ZOS code uses only horizontal or vertical gradients, i.e. either normalX == 0 or normalY == 0.

I wanted to fade bottom left and right corners, so I did this:

Lua Code:
  1. local extent = self:GetScrollExtents()
  2. local offset = self:GetScrollOffsets()
  3. self:SetFadeGradient(1, 1, -1, zo_clamp(offset, 0, 15))
  4. self:SetFadeGradient(2, -1, -1, zo_clamp(extent - offset, 0, 15))

On the right corner it works well (ZO_HUDFadeSceneFra...)


But not so much on the left corner:


The problem is that gradient #1 always starts from the TOPLEFT corner, and gradient #2 always starts from the BOTTOMRIGHT corner.

SetFadeGradient could set origin based on the direction of the vector:
for gradient #1
Lua Code:
  1. if normalX >= 0 and normalY >= 0 then origin = TOPLEFT
  2. elseif normalX >= 0 and normalY < 0 then origin = BOTTOMLEFT
  3. elseif normalX < 0 and normalY >= 0 then origin = TOPRIGHT
  4. else origin = BOTTOMRIGHT
  5. end
for gradient #2
Lua Code:
  1. if normalX <= 0 and normalY <= 0 then origin = BOTTOMRIGHT
  2. elseif normalX <= 0 and normalY > 0 then origin = TOPRIGHT
  3. elseif normalX > 0 and normalY <= 0 then origin = BOTTOMLEFT
  4. else origin = TOPLEFT
  5. end
 

ESOUI » Developer Discussions » Wish List » [outdated] ScrollControl:SetFadeGradient in any direction


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off