def _text_to(view: 'BoardViewWidget', pad: 'Pad', r: Rect, mat: 'ndt.NDArray[numpy.float64]', textcol_a: float) -> None: mat = mat.dot(pad.translate_mat) # zero-out rotation mat[0:2, 0:2] = view.viewState.glMatrix[0:2, 0:2] # Hack text_height_px = view.viewState.scale_factor * r.height # Hack pname = pad.pad_name if text_height_px < 14: alpha = 0 textcol_a[3] = (text_height_px - 6) / 8 if text_height_px < 6: return elif 14 <= text_height_px <= TRANSITION_POINT_1: alpha = 0 elif text_height_px > TRANSITION_POINT_1: if pname != "": if text_height_px > TRANSITION_POINT_2: alpha = 1 else: alpha = (text_height_px - TRANSITION_POINT_1) / (TRANSITION_POINT_2 - TRANSITION_POINT_1) else: alpha = 0 h_delta_1 = r.height * (1 - RATIO * alpha) h_delta_2 = r.height * (RATIO - RGAP) * alpha r_top = Rect.fromRect(r) r_top.bottom = r_top.top - h_delta_1 r.top = r.bottom + h_delta_2 view.text_batch.submit_text_box(mat, "%s" % pad.pad_no, r_top, textcol_a, None) if alpha: view.text_batch.submit_text_box(mat, "%s" % pname, r, textcol_a, None)