Mouse in the Map View
Updated 05 Apr 2018
|
Upper levels: - QuArK Information Base - 4. The Source Code - 4.4. Specific Topics |
4.4.4. Mouse in the Map View |
[ | - - ]
Processing mouse events (moves, drags and clicks) is distributed between the Python and Delphi components of QuArK. The mapview control (see 'Methods of Map View controls') is basically in charge of it all. When a map or model editor is launched, mapview controls get associated with certain areas of the screen. These have an onmouse callback function, which is assigned to a Python-defined function by a line like this (from quarkpy.qbaseeditor): v.onmouse = self.mousemap def mousemap(self, view, x, y, flags, handle): For clicks, the real processing is done by the MouseClicked function, which is defined by the editor's HandlesModule (maphandles for the map editor), which itself calls the mapview method Clicktarget. This latter is defined in Delphi, and calls the AnalyseClic methods of the various kinds of map objects to find out if the click was 'over' each object in the map. These methods take as parameter a List, to which they add the click-ed on stuff they find. A bit oddly, the map editor's MouseClicked method calls on the qhandle MouseClicked method for some processing, I'm not sure why it's set up this way, but anyway Python is responsible for the 'drill thru' selection model whereby the top thing is selected first, then the one under that, etc, and quite a lot of selection behavior can be manipulated in Python. |
Copyright (c) 2022, GNU General Public License by The QuArK (Quake Army Knife) Community - https://quark.sourceforge.io/ |
[ Top - ] | -