Custon pop out window appearing in wrong place

Hi. I’m extremely new to coding so any help would be appreciated. Basically I’m trying to create an addon to take my longer actions and turn them into small actions by deleting the keyframes that I don’t need. I was able to get the addon pretty much done, but am having trouble getting the pop up window to behave correctly. See, I created a panel for the toolshelf, where it works just fine, but it also pops up when I click in the area for the markers(like in the bottom of the timeline/dopesheet area). Here is the code if anybody can help a lost and frustrated guy out.

bl_info = {
    "name": "Create Action",
    "author": "",
    "version": (0, 6),
    "blender": (2, 80, 0),
    "location": "View3D > Toolshelf > Marker Select",
    "description": "",
    "category": "Animation"
}



import bpy
from bpy import ops

#filepath = "//actions.blend"

        

class MarkerSelect(bpy.types.Operator):
    """Marker Select"""
    bl_idname = "marker.select"
    bl_label = "Set Action Range"
    bl_options = {'REGISTER', 'UNDO'}
    
    #rename_action = bpy.props.StringProperty(name="Action Name")
    
    start_marker: bpy.props.IntProperty(
        name="In Point",
        description="Set First Marker",
        min=0, max=300000,
        default=1,
    )
    end_marker: bpy.props.IntProperty(
        name="Out Point",
        description="Set Second Marker",
        min=1, max=300000,
        default=250,
    )
    
    
    
            
    def invoke(self, context, _event):
        wm = context.window_manager
        return wm.invoke_props_dialog(self)

    
    @classmethod
    def poll(cls, context):
        return context.active_object is not None
        
    
    
    
    # Create Markers
    def execute(self, context):
        scene = context.scene
        obj = bpy.context.object                                                 #active object
        action = obj.animation_data.action                                       #current action
        
        inPoint = scene.timeline_markers.new('InPoint', frame=self.start_marker)
        outPoint = scene.timeline_markers.new('OutPoint', frame=self.end_marker)     #Add markers

        
        area = bpy.context.area                                                 #Set area to dopesheet
        old_type = area.type
        area.type = 'DOPESHEET_EDITOR'
        ops.action.clickselect(deselect_all=True)                               #Deselect all keyframes
        area.type = old_type                                                     #Return area
        
        start = scene.timeline_markers.get("InPoint")
        if start:
            print(start.name,start.frame,start.select)
        end = scene.timeline_markers.get("OutPoint")
        if start:
            print(end.name,end.frame,end.select)
        
        
        for i in action.fcurves:
            for x in i.keyframe_points:
                if x.co[0] > start.frame and x.co[0] < end.frame:              #check greater than/less than marker frames
                    x.select_control_point=False                                 #deselect if in between markers
                else:
                    x.select_control_point=True                                   #select if outside of markers
                    
                    
        
        #Create New Action
        
        if action:
            print(action.name)                                                      #Grab current action name

        action_copy = bpy.data.actions[action.name].copy()                          #Copy current action


        obj.animation_data.action = action_copy                                      #Set action to copy

        if action:
            print(action_copy.name)                                                  #Grab action copy name


        old_name = action.name
        copy_name = action_copy.name
        #new_name = 'heyhey'

        #for action in bpy.data.actions:                                               #Set action copy name to new name
            #if bpy.data.actions[action_copy.name].name == copy_name:
                #bpy.data.actions[action_copy.name].name = new_name

        scene.timeline_markers.remove(inPoint)
        scene.timeline_markers.remove(outPoint)
        ops.action.delete()                                        #Delete Inverted Keyframes
        
        
        #data_blocks = set(bpy.data.actions[action_copy.name])
        #data_blocks = set(bpy.data.actions)
        #bpy.data.libraries.write(filepath, data_blocks, fake_user=True)
        
        
                    
                    
        return {'FINISHED'}
        




    
    
class MarkersPanel(bpy.types.Panel):
    bl_label = "Action Manager"
    bl_idname = "mpanel"
    bl_space_type = "VIEW_3D"   
    bl_region_type = "UI"
    bl_category = "Act Man"
    bl_context = "objectmode"

    def draw(self, context):
        layout = self.layout
        layout.operator(MarkerSelect.bl_idname)

def register():
    bpy.utils.register_class(MarkersPanel)
    bpy.utils.register_class(MarkerSelect)
    
def unregister():
    bpy.utils.unregister_class(MarkerSelect)
    bpy.utils.unregister_class(MarkersPanel)
    
    
if __name__ == "__main__":
    register()