Jump to content

Эффект масштабирования изображения


Recommended Posts

Ребят, помогите откалибровать скрипт чтоб картинка нормально масштабировалась и двигалась в увеличенном виде за мышкой влево-вправо, пол недели парюсь. Пока что только сделал основу.

Пример: http://ruseller.com/adds/adds2572/example/index.html "Внутренняя линза"

http://www.starplugins.com/cloudzoom/examples "Inner Zoom"

local sx, sy = guiGetScreenSize() 
showCursor(true) 
setCursorPosition(501, 501) 
  
local offset = 0 
function scrollDown() 
  if offset >= 40 then 
    offset = offset - 40 
  end    
end 
function scrollUp() 
  if offset <= 1640 then 
    offset = offset + 40 
  end    
end 
  
bindKey("mouse_wheel_down", "down", scrollDown) 
bindKey("mouse_wheel_up", "down", scrollUp) 
  
addEventHandler("onClientRender", root, function() 
    if isCursorShowing() then 
        cx, cy = getCursorPosition() 
        cx = cx * sx  
        cy = cy * sy 
    end 
    if cx > 500 and cx < 500 + 300 and cy > 500 and cy < 500 + 300 then 
        cxx = cx * (sx / sx) + (offset/2) 
        cyy = cy * (sy / sy) + (offset/4) 
    end 
    dxDrawImageSection(500, 500, 300, 300, cxx, cyy, sx - offset, sy - (offset/2), "test.png") 
end) 

Ссылка на скрипт http://rghost.ru/51480663

Link to comment
  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...