melink14/rikaikun

Google Docs: Rikiakun detection is incorrect when document zoom applied

melink14 opened this issue · 1 comments

  1. Zoom into a Google doc with Japanese text.
  2. Note that reported words get less accurate as you move further right from the beginning of the line.

Details:

100%

transform="matrix(1,0,0,1,96.00000000000001,340.7015999999999)"

200% zoom:

transform="matrix(2,0,0,2,192.00000000000003,681.4031999999999)"

Right now rikaikun just sets position and size/font of Google Docs text sections in order to capture text under mouse but it turns out that the incresae size due to zoom is only captured in the matrix transform attribute.

Unfortunately, if I just try to use the same matrix transform it doesn't work with the currently absolutely positioned text simulation and so I need a more robust solution.

It looks like it could work if I just extract the scale factor and set it as a transform with transform-origin also set.

Or I could maybe find the original rect origin by adding the containing svg coordinates to the grect x,y coordinates.