@datagrok/bio 2.10.9 → 2.10.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "Leonid Stolbov",
6
6
  "email": "lstolbov@datagrok.ai"
7
7
  },
8
- "version": "2.10.9",
8
+ "version": "2.10.10",
9
9
  "description": "Bioinformatics support (import/export of sequences, conversion, visualization, analysis). [See more](https://github.com/datagrok-ai/public/blob/master/packages/Bio/README.md) for details.",
10
10
  "repository": {
11
11
  "type": "git",
@@ -34,8 +34,8 @@ type TempType = { [tagName: string]: any };
34
34
  const undefinedColor = 'rgb(100,100,100)';
35
35
  const monomerToShortFunction: MonomerToShortFunc = monomerToShort;
36
36
 
37
- function getUpdatedWidth(grid: DG.Grid | null, g: CanvasRenderingContext2D, x: number, w: number): number {
38
- return grid ? Math.min(grid.canvas.width - x, w) : g.canvas.width - x;
37
+ function getUpdatedWidth(grid: DG.Grid | null, g: CanvasRenderingContext2D, x: number, w: number, dpr: number): number {
38
+ return !!grid ? Math.max(Math.min(grid.canvas.width / dpr - x, w)) : Math.max(g.canvas.width / dpr - x, 0);
39
39
  }
40
40
 
41
41
  export function processSequence(subParts: ISeqSplitted): [string[], boolean] {
@@ -182,11 +182,12 @@ export class MacromoleculeSequenceCellRenderer extends DG.GridCellRenderer {
182
182
 
183
183
  g.save();
184
184
  try {
185
+ const dpr = window.devicePixelRatio;
185
186
  const grid = gridCell.gridRow !== -1 ? gridCell.grid : null;
186
187
  const value: any = gridCell.cell.value;
187
188
  const paletteType = tableCol.getTag(bioTAGS.alphabet);
188
189
  const minDistanceRenderer = 50;
189
- w = getUpdatedWidth(grid, g, x, w);
190
+ w = getUpdatedWidth(grid, g, x, w, dpr);
190
191
  g.beginPath();
191
192
  g.rect(x + this.padding, y + this.padding, w - this.padding - 1, h - this.padding * 2);
192
193
  g.clip();
@@ -263,13 +264,14 @@ export class MacromoleculeDifferenceCellRenderer extends DG.GridCellRenderer {
263
264
  render(
264
265
  g: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, gridCell: DG.GridCell,
265
266
  _cellStyle: DG.GridCellStyle): void {
267
+ const dpr = window.devicePixelRatio;
266
268
  const grid = gridCell.grid;
267
269
  const cell = gridCell.cell;
268
270
  const tableCol = gridCell.tableColumn as DG.Column<string>;
269
271
  const s: string = cell.value ?? '';
270
272
  const separator = tableCol.tags[bioTAGS.separator];
271
273
  const units: string = tableCol.tags[DG.TAGS.UNITS];
272
- w = getUpdatedWidth(grid, g, x, w);
274
+ w = getUpdatedWidth(grid, g, x, w, dpr);
273
275
  //TODO: can this be replaced/merged with splitSequence?
274
276
  const [s1, s2] = s.split('#');
275
277
  const splitter = getSplitter(units, separator);