GE Lua Documentation

Press F to search!

GetMousePos

Definition


-- @/lua/common/extensions/ui/imgui_gen_luaintf.lua:1151
function M.GetMousePos() return imgui.GetMousePos() end

Callers

@/lua/common/extensions/ui/imguiUtils.lua
function M.IsWindowHovered(windowPos, windowSize)
  local mousePos = imgui.GetMousePos()
  if (mousePos.x > windowPos.x and mousePos.x < (windowPos.x + windowSize[0].x)) and (mousePos.y > windowPos.y and mousePos.y < (windowPos.y + windowSize[0].y)) then
@/lua/ge/extensions/editor/gen/world.lua
	smouse = rayCast.pos
	cscreen = {im.GetMousePos().x, im.GetMousePos().y}
	local ray = getCameraMouseRay()
	smouse = rayCast.pos
	cscreen = {im.GetMousePos().x, im.GetMousePos().y}
	local ray = getCameraMouseRay()
	smouse = rayCast.pos
	cscreen = {im.GetMousePos().x, im.GetMousePos().y}
	if rayCast.object.name == nil then return end
	smouse = rayCast.pos
	cscreen = {im.GetMousePos().x, im.GetMousePos().y}
	if rayCast.object.name == nil then return end
	local ray = getCameraMouseRay()
	local dwin = {im.GetMousePos().x - cscreen[1], im.GetMousePos().y - cscreen[2]}
	cscreen = {im.GetMousePos().x, im.GetMousePos().y}
	local ray = getCameraMouseRay()
	local dwin = {im.GetMousePos().x - cscreen[1], im.GetMousePos().y - cscreen[2]}
	cscreen = {im.GetMousePos().x, im.GetMousePos().y}
	local dwin = {im.GetMousePos().x - cscreen[1], im.GetMousePos().y - cscreen[2]}
	cscreen = {im.GetMousePos().x, im.GetMousePos().y}
	local camDir = ray.dir:normalized() -- core_camera.getForward():normalized()
	local dwin = {im.GetMousePos().x - cscreen[1], im.GetMousePos().y - cscreen[2]}
	cscreen = {im.GetMousePos().x, im.GetMousePos().y}
	local camDir = ray.dir:normalized() -- core_camera.getForward():normalized()
	local ds = rayCast.pos - smouse
	local dwin = {im.GetMousePos().x - cscreen[1], im.GetMousePos().y - cscreen[2]}
--            lo('?? mdrag:') --..dwin[1]..':'..dwin[2]..':'..rayCast.object.name)
	local ds = rayCast.pos - smouse
	local dwin = {im.GetMousePos().x - cscreen[1], im.GetMousePos().y - cscreen[2]}
--            lo('?? mdrag:') --..dwin[1]..':'..dwin[2]..':'..rayCast.object.name)

						screen = im.GetMousePos(),
						cpos = U.boxMark(dmesh[cmesh].obj, out),
	--            lo('?? Z_DRAG:'..tostring(cmesh))
	--                lo('?? mark:'..tostring(im.GetMousePos())..':'..tostring(rayCast.normal)..':'..tostring(core_camera.getForward()))
	--        if true then return end
		if #cedit.cval == 0 then
			cedit.cval = {im.GetMousePos().x, core_camera.getPosition()}
		end
		end
		local dx = im.GetMousePos().x - cedit.cval[1]
		local pos = cedit.cval[2]
		local newdir = U.vturn(dir, -dx/1000)
--        lo('?? around:'..dx..':'..tostring(core_camera.getForward())..':'..tostring(newdir:normalized())) --..':'..tostring(im.GetMousePos().x))
		local newpos = ccenter - newdir
			cedit.cval['DragRot'] = {
				screen = {im.GetMousePos().x},
				center = center}
		end
		local dx = im.GetMousePos().x - cedit.cval['DragRot'].screen[1]
		cedit.cval['DragRot'].screen = {im.GetMousePos().x}
		local dx = im.GetMousePos().x - cedit.cval['DragRot'].screen[1]
		cedit.cval['DragRot'].screen = {im.GetMousePos().x}
--            _dbdrag = true
--                cedit.cval = {floor.pos, rayCast.object.name}
--                cedit.cval = {im.GetMousePos().x, im.GetMousePos().y, floor.pos}
			end
--                cedit.cval = {floor.pos, rayCast.object.name}
--                cedit.cval = {im.GetMousePos().x, im.GetMousePos().y, floor.pos}
			end
			end
--            local dx = im.GetMousePos().x - cedit.cval[1]
--            local dy = im.GetMousePos().y - cedit.cval[2]
--            local dx = im.GetMousePos().x - cedit.cval[1]
--            local dy = im.GetMousePos().y - cedit.cval[2]
				end
--                cscreen = {im.GetMousePos().x, im.GetMousePos().y}
			end
				end
--                cscreen = {im.GetMousePos().x, im.GetMousePos().y}
			end
	if not cedit.cval['CamRot'] then
--                cedit.cval = {im.GetMousePos().x, core_camera.getPosition()}
		local desc = adesc[cedit.mesh]
@/lua/ge/extensions/editor/meshEditor.lua
      if selectedMesh and editor.keyModifiers.alt and editor.getPreference(M.preferencesName .. ".general.dragWidth") then
        local cursorPos = im.GetMousePos()
        local width = math.max(oldNodeWidth + (cursorPos.x - cursorOldPosition2D.x) / 10.0, 0)
            oldNodeWidth = selectedMesh:getNodeWidth(tempNodeIndex)
            cursorOldPosition2D = im.GetMousePos()
          end
          mouseButtonHeldOnNode = true
          cursorOldPosition2D = im.GetMousePos()
          tempNodeIndex = tempNodeIndex or 0
@/lua/ge/extensions/editor/resourceChecker.lua
            if active then
              local my = im.GetMousePos().y
              local last = assetTreemapState._dragLastY or my
@/lua/ge/extensions/editor/biomeTool.lua
    imgui.OpenPopup("Select Forest Brush (Central)")
    var.layers.PopupOpenMousePos.x = imgui.GetMousePos().x
    var.layers.PopupOpenMousePos.y = imgui.GetMousePos().y
    var.layers.PopupOpenMousePos.x = imgui.GetMousePos().x
    var.layers.PopupOpenMousePos.y = imgui.GetMousePos().y
    syncSelectedTempBrushListFunc(enum_forestBrushItemZone.central)
    imgui.OpenPopup("Select Forest Brush (Falloff)")
    var.layers.PopupOpenMousePos.x = imgui.GetMousePos().x
    var.layers.PopupOpenMousePos.y = imgui.GetMousePos().y
    var.layers.PopupOpenMousePos.x = imgui.GetMousePos().x
    var.layers.PopupOpenMousePos.y = imgui.GetMousePos().y
    syncSelectedTempBrushListFunc(enum_forestBrushItemZone.falloff)
      imgui.OpenPopup("Select Forest Brush (Edge)")
      var.layers.PopupOpenMousePos.x = imgui.GetMousePos().x
      var.layers.PopupOpenMousePos.y = imgui.GetMousePos().y
      var.layers.PopupOpenMousePos.x = imgui.GetMousePos().x
      var.layers.PopupOpenMousePos.y = imgui.GetMousePos().y
      syncSelectedTempBrushListFunc(enum_forestBrushItemZone.edge)
@/lua/ge/extensions/editor/inspector.lua
          end
          headerMenu.pos = imgui.ImVec2(imgui.GetMousePos().x - 150 * editor.getPreference("ui.general.scale"), imgui.GetMousePos().y + 10)
        end
          end
          headerMenu.pos = imgui.ImVec2(imgui.GetMousePos().x - 150 * editor.getPreference("ui.general.scale"), imgui.GetMousePos().y + 10)
        end
  local updateGroundCoverUVHandle = function ()
    groundCoverUVDragPos = imgui.GetMousePos()
    local xConstraint = nil
    local constraints = {xConstraint, yConstraint}
    local sqNewPos = imgui.GetMousePos()
      draggingGCUVHandleSq = hoveredHandleSquare
      groundCoverUVDragPos = imgui.GetMousePos()
      groundCoverUVHandlesOnDragStart = deepcopy(groundCoverUVHandles)
@/lua/ge/extensions/editor/renderTest.lua
    if im.IsMouseClicked(0) then
      lastMouseDragPos = im.GetMousePos()
    end
      attachToObject[0] = false
      local mPos = im.GetMousePos()
      delta.x = (mPos.x - lastMouseDragPos.x) * 0.02 * (fov[0] / 50)
      pos.y = pos.y + delta.y
      lastMouseDragPos = im.GetMousePos()
    end
@/lua/ge/extensions/editor/vehicleDetailViewer.lua
        view.isDragging = true
        view._DragInitialMousePos = im.GetMousePos()
      else
      else
        local currentMouse = im.GetMousePos()
        view.dragOffset.x = view.dragOffset.x - (currentMouse.x - view._DragInitialMousePos.x) / meterToPixelScale * 0.9 * view.zoom * 2
@/lua/ge/extensions/editor/sceneView.lua
      if im.IsMouseClicked(0) then
        view.lastMouseDragPos = im.GetMousePos()
      end
      if view.mouseDragging0 then
        local mPos = im.GetMousePos()
        delta.x = (mPos.x - view.lastMouseDragPos.x) * 0.005 * (view.fov[0] / 50)
          end
          view.lastMouseDragPos = im.GetMousePos()
@/lua/ge/extensions/editor/roadEditor.lua
  if rayCast then rayCastHit = rayCast.pos end
  local mousePos = im.GetMousePos()
        if dragStartPosition then
          local cursorPosImVec = im.GetMousePos()
          local cursorPos = vec3(cursorPosImVec.x, cursorPosImVec.y, 0)
    if mouseButtonHeldOnNode and im.IsMouseDown(0) and mouseMoved then
      local cursorPosImVec = im.GetMousePos()
      local cursorPos = vec3(cursorPosImVec.x, cursorPosImVec.y, 0)
  if im.IsMouseClicked(0) and not (im.IsAnyItemHovered() or im.IsWindowHovered(im.HoveredFlags_AnyWindow) or editor_inspector.comboMenuOpen) then
    dragMouseStartPos = vec3(im.GetMousePos().x, im.GetMousePos().y, 0)
    if not editor.keyModifiers.alt and not isRectSelectKeyCombinationActive then
  if im.IsMouseClicked(0) and not (im.IsAnyItemHovered() or im.IsWindowHovered(im.HoveredFlags_AnyWindow) or editor_inspector.comboMenuOpen) then
    dragMouseStartPos = vec3(im.GetMousePos().x, im.GetMousePos().y, 0)
    if not editor.keyModifiers.alt and not isRectSelectKeyCombinationActive then
  isRectSelecting = true
  rectSelectDragMouseStartPos = im.GetMousePos()
elseif isRectSelecting and (not isRectSelectKeyCombinationActive or im.IsMouseReleased(0)) then
@/lua/ge/extensions/editor/slotTrafficEditor.lua
    if im.IsMouseClicked(0) and not (im.IsAnyItemHovered() or im.IsWindowHovered(im.HoveredFlags_AnyWindow)) then
      dragMouseStartPos = vec3(im.GetMousePos().x, im.GetMousePos().y, 0)
      if not editor.keyModifiers.alt then
    if im.IsMouseClicked(0) and not (im.IsAnyItemHovered() or im.IsWindowHovered(im.HoveredFlags_AnyWindow)) then
      dragMouseStartPos = vec3(im.GetMousePos().x, im.GetMousePos().y, 0)
      if not editor.keyModifiers.alt then
    if mouseButtonHeldOnNode and im.IsMouseDown(0) then
      local cursorPosImVec = im.GetMousePos()
      local cursorPos = vec3(cursorPosImVec.x, cursorPosImVec.y, 0)
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veView.lua
  if im.IsMouseClicked(0) then
    view.lastMouseDragPos = im.GetMousePos()
  end
  if view.mouseDragging0 then
    local mPos = im.GetMousePos()
    delta.x = (mPos.x - view.lastMouseDragPos.x) * 0.005 * (view.fov[0] / 50)
      end
      view.lastMouseDragPos = im.GetMousePos()
@/lua/ge/extensions/editor/sceneTree.lua
    -- Check if hovering between items
    local mousePosY = imgui.GetMousePos().y
    local itemRect = {min = imgui.GetItemRectMin(), max = imgui.GetItemRectMax()}
        end
        local mousePos = imgui.GetMousePos()
        if mousePos.x < imgui.GetWindowPos().x + imgui.GetWindowWidth() - 16 then
        end
        local mouseDragEndPos = imgui.GetMousePos()
        local scrollYDiff = imgui.GetScrollY() - instance.mouseDragStartScrollY
@/lua/ge/extensions/editor/forestEditor.lua
          end
          mouseDragStartPos = im.GetMousePos()
        end
@/lua/ge/extensions/editor/api/gizmo.lua

  local pt2i = editor.screenToClient(Point2I(imgui.GetMousePos().x, imgui.GetMousePos().y))
  local pt = Point2F(pt2i.x, pt2i.y)

  local pt2i = editor.screenToClient(Point2I(imgui.GetMousePos().x, imgui.GetMousePos().y))
  local pt = Point2F(pt2i.x, pt2i.y)
  if camMouseRay then
    local mousePos = Point2I(imgui.GetMousePos().x, imgui.GetMousePos().y) --TODO: single call
    -- start to drag object selection's gizmo
  if camMouseRay then
    local mousePos = Point2I(imgui.GetMousePos().x, imgui.GetMousePos().y) --TODO: single call
    -- start to drag object selection's gizmo
@/lua/ge/extensions/flowgraph/manager.lua
function C:creationWorkflow()
  local mp = im.GetMousePos()
  if ui_flowgraph_editor.BeginCreate(im.ImVec4(1, 1, 1, 1), 2) then
  local copiedNodesTblSize = tableSize(self.copyData.nodes)
  local mousePos = ui_flowgraph_editor.ScreenToCanvas(im.GetMousePos())
  local center = im.ImVec2(0, 0)
@/lua/ge/extensions/editor/flowgraph/main.lua
      local node = self.mgr.graph:createNode(self.mgr.dragDropData.node.path)
      local pos = ui_flowgraph_editor.ScreenToCanvas(im.GetMousePos())
      ui_flowgraph_editor.SetNodePosition(node.id, pos)
      local instance = self.mgr:createMacroInstanceFromPath(self.mgr.dragDropData.node.path, node)
      local pos = ui_flowgraph_editor.ScreenToCanvas(im.GetMousePos())
      ui_flowgraph_editor.SetNodePosition(node.id, pos)
      local node = self.mgr.graph:createNode(nodePath)
      local pos = ui_flowgraph_editor.ScreenToCanvas(im.GetMousePos())
      ui_flowgraph_editor.SetNodePosition(node.id, pos)
function C:doContextMenus()
  local mousePos = im.GetMousePos()
  ui_flowgraph_editor.Suspend()
@/lua/ge/extensions/editor/flowgraph/variables.lua
    table.insert(insertPositions, im.GetCursorScreenPos().y)
    local mousePos = im.GetMousePos()
    for i, y in ipairs(insertPositions) do
@/lua/ge/extensions/editor/materialEditor.lua
  else
    im.SetWindowPos1(im.GetMousePos(), im.Cond_Appearing)
  end
@/lua/ge/extensions/editor/api/valueInspector.lua
    filenameContextMenu.open = true
    filenameContextMenu.pos = imgui.GetMousePos()
    filenameContextMenu.fieldName = fieldName
    copyPasteMenu.open = true
    copyPasteMenu.pos = imgui.GetMousePos()
    copyPasteMenu.fieldName = fieldName
  if not popupWasPositioned then
    local mousePos = imgui.GetMousePos()
    local displaySize = imgui.GetIO().DisplaySize
@/lua/ge/extensions/util/maptiles.lua
        -- Handle mouse clicks on the tile
        local mousePos = im.GetMousePos()
        if im.IsMouseHoveringRect(im.ImVec2(x, y), im.ImVec2(x + cellWidth, y + cellHeight)) then
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veAdjustableTechCarTuner.lua
      im.SetCursorPos(im.ImVec2(5, 50))
      im.Text(string.format("Mouse Pos: %0.2f, %0.2f", im.GetMousePos().x - wndPos.x, im.GetMousePos().y - wndPos.y))
      local x, y = im.GetMousePos().x - wndPos.x  - viewToDebug.imgPos.x, im.GetMousePos().y - wndPos.y - viewToDebug.imgPos.y
      im.SetCursorPos(im.ImVec2(5, 50))
      im.Text(string.format("Mouse Pos: %0.2f, %0.2f", im.GetMousePos().x - wndPos.x, im.GetMousePos().y - wndPos.y))
      local x, y = im.GetMousePos().x - wndPos.x  - viewToDebug.imgPos.x, im.GetMousePos().y - wndPos.y - viewToDebug.imgPos.y
      im.Text(string.format("Mouse Pos: %0.2f, %0.2f", im.GetMousePos().x - wndPos.x, im.GetMousePos().y - wndPos.y))
      local x, y = im.GetMousePos().x - wndPos.x  - viewToDebug.imgPos.x, im.GetMousePos().y - wndPos.y - viewToDebug.imgPos.y
      im.Text(string.format("Mouse Pos Rel Img: %0.3f, %0.3f", x / viewToDebug.imgSize.x, y / viewToDebug.imgSize.y))
      im.Text(string.format("Mouse Pos: %0.2f, %0.2f", im.GetMousePos().x - wndPos.x, im.GetMousePos().y - wndPos.y))
      local x, y = im.GetMousePos().x - wndPos.x  - viewToDebug.imgPos.x, im.GetMousePos().y - wndPos.y - viewToDebug.imgPos.y
      im.Text(string.format("Mouse Pos Rel Img: %0.3f, %0.3f", x / viewToDebug.imgSize.x, y / viewToDebug.imgSize.y))
@/lua/ge/extensions/editor/flowgraphEditor.lua
  end
  local mousePos = im.GetMousePos()
  if mousePos.x == lastMousePos.x and mousePos.y == lastMousePos.y then
  end
  lastMousePos = im.GetMousePos()
@/lua/ge/extensions/freeroam/bigMapMode.lua

  local mousePos = imgui.GetMousePos()
  if lastMousePos and (mousePos.x ~= lastMousePos.x or mousePos.y ~= lastMousePos.y) then
@/lua/ge/extensions/core/vehicle/mirror.lua
local function _mouseUpdate(save)
  local mousePos = vec3(im.GetMousePos().x, im.GetMousePos().y, 1)
  local offset = (mouseData.startPos - mousePos) * screenRatio
local function _mouseUpdate(save)
  local mousePos = vec3(im.GetMousePos().x, im.GetMousePos().y, 1)
  local offset = (mouseData.startPos - mousePos) * screenRatio
    mouseInteraction = true
    local mousePos = im.GetMousePos()
    mouseData.startPos = vec3(mousePos.x,mousePos.y,1)
@/lua/ge/extensions/editor/toolUtilities/splineInput.lua
  local mousePos = util.mouseOnMapPos()
  local mouseRawY = im.GetMousePos().y
  mouseVel2D:set(mousePos.x - mouseLast.x, mousePos.y - mouseLast.y, 0.0)
  -- Update the mouse position and velocity, and cache the current mouse state.
  local mouseRawY = im.GetMousePos().y -- The current raw mouse y-position (2D).
  local mousePos = util.mouseOnMapPos() -- The current mouse position on the map (3D).
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veStaticRenderView.lua
local function unprojectRayIntoRVImg(rvData)
  local mousePos = im.GetMousePos()

  local mousePos = im.GetMousePos()
@/lua/ge/extensions/editor/objectTool.lua
      and not editor.isAxisGizmoHovered() then
    mouseDragStartPos = imgui.GetMousePos()
  end