clZoomZoneScreen = {}
-------------------------------------------------------------------------------
setmetatable(clZoomZoneScreen, {__index = clWindow})
-------------------------------------------------------------------------------
function clZoomZoneScreen:OnClick(item_name) 
    if(clApplication.game_pause) then return end
    
    if(self.onObjectClick and self:onObjectClick(item_name)) then  return true; end
    
    if(item_name == "zoom_close") then
        SoundPlay("sound/interface/button.ogg")
        self.parent:CloseZoom();
    end   
    
    if(self.apply_tool_zones and #self.apply_tool_zones > 0) then
        for key, value in pairs(self.apply_tool_zones) do
            if(item_name == value.trigger and Inventory:GetActiveObj() == value.tool_name) then
                value:end_fun();
                Inventory.lock_drag = true;
                return true;
            end
        end 
    end
end
-------------------------------------------------------------------------------
function clZoomZoneScreen:AddToolApplyZone(trigger, tool_name, end_fun, return_to_inv)
    self.apply_tool_zones = self.apply_tool_zones or {}
    
    local _apply_zone = {}
    
    _apply_zone.trigger = trigger;
    _apply_zone.tool_name = tool_name;
    _apply_zone.end_fun = end_fun
    _apply_zone.return_to_inv = return_to_inv or true;
    
    table.insert(self.apply_tool_zones, _apply_zone)
end
-------------------------------------------------------------------------------
function clZoomZoneScreen:Disable()
    self.apply_tool_zones = {}
    self.disable = true;
    self.parent:CloseZoom();
end
-------------------------------------------------------------------------------
function NewZoomZone(objects_list, win_name, _script_name)
	objects_list[win_name] = {}
	setmetatable(objects_list[win_name], {__index =  clZoomZoneScreen})
	objects_list[win_name].name = win_name;
	objects_list[win_name].script_name = _script_name;
	objects_list[win_name].win = false;
	GameScreen = objects_list[win_name];
	require(_script_name);
end
