Skip to content

Commit c502efd

Browse files
authored
Solve Retina display issues
Initially x1,y1,x2,y2 coordinates in pixel where multiplied by 2 on retina displays but when grabbing you divide by 2 again. This does not solve the issue which is related only to grab where only the box captured must be scaled. Hence the proposed change solve the issue and you can verify with img.show() to check the part of the screen captured
1 parent 1a109bc commit c502efd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pix2tex/gui.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,10 @@ def mouseReleaseEvent(self, event):
276276
# account for retina display. #TODO how to check if device is actually using retina display
277277
factor = 2 if sys.platform == "darwin" else 1
278278

279-
x1 = int(min(startPos[0], endPos[0])*factor)
280-
y1 = int(min(startPos[1], endPos[1])*factor)
281-
x2 = int(max(startPos[0], endPos[0])*factor)
282-
y2 = int(max(startPos[1], endPos[1])*factor)
279+
x1 = int(min(startPos[0], endPos[0]))
280+
y1 = int(min(startPos[1], endPos[1]))
281+
x2 = int(max(startPos[0], endPos[0]))
282+
y2 = int(max(startPos[1], endPos[1]))
283283

284284
self.repaint()
285285
QApplication.processEvents()
@@ -296,6 +296,9 @@ def mouseReleaseEvent(self, event):
296296
self.begin = QtCore.QPoint()
297297
self.end = QtCore.QPoint()
298298
self.parent.returnSnip(img)
299+
300+
301+
img.show() #this line is used only to check what part of the screen is captured. It can be deleted later
299302

300303

301304
def main(arguments):

0 commit comments

Comments
 (0)