All pastes #798989 Raw Edit

Mine

public lua v1 · immutable
#798989 ·published 2007-11-27 05:24 UTC
rendered paste body
                local radiusFactor = 1;                -- Calculate map radius at that angle                if (not quadTable[quadrantIndex]) then                        radiusFactor = 1  / math.cos(quadMod(angle));                        -- Smooth corners if you want, use any value up to sqrt(2)                        radiusFactor = min(radiusFactor, 1.35);                        mapRadius = mapRadius * radiusFactor;                        --Sea.io.print(radiusFactor)                        --offset = offset * radiusFactor                        -- BUG: when you make the offset negative much on a square minimap,                        -- the button drags in a star pattern with the corners sticking out.                end                -- Calculate full radius (dist from center of map to center of button)                -- If necessary calculate the button offset     from the edge of the minimap                if self.isMoving then                        -- radius is static                        --radius = self.radius or mapRadius + buttonRadius + offset;                        radius = mapRadius + buttonRadius + offset * radiusFactor;                else                        -- radius is calculated from the cursor position                        radius = math.cos(angle) * y + math.sin(angle) * x;                        -- offset is calculated from the radius                        offset = radius - mapRadius - buttonRadius;                        -- don't allow offsets that make the radius negative                        if (offset < -mapRadius+buttonRadius) then                                offset = -mapRadius+buttonRadius;                                -- recalculate the radius with the minimal offset                                radius = mapRadius + buttonRadius + offset;                        end                        offset = offset / radiusFactor;                end