Skip to content

Commit

Permalink
feat(pointcloud): Update projection render size
Browse files Browse the repository at this point in the history
  • Loading branch information
laoluo committed Sep 21, 2023
1 parent 0ef7522 commit 206476c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,13 @@ export default class ViewOperation extends BasicToolOperation {
const size = { width: this.imgNode.width, height: this.imgNode.height };
const { ctx, canvas: offsetCanvas } = CanvasUtils.createCanvas(size);
if (ctx && data?.length > 0) {
// 1.
DrawUtils.drawPixel({ canvas: offsetCanvas, points: data, size, defaultRGBA: annotation.defaultRGBA });
DrawUtils.drawPixel({
canvas: offsetCanvas,
points: data,
size,
defaultRGBA: annotation.defaultRGBA,
pixelSize: 13,
});
DrawUtils.drawImg(this.canvas, offsetCanvas, {
zoom: this.zoom,
currentPos: this.currentPos,
Expand Down
5 changes: 2 additions & 3 deletions packages/lb-annotation/src/utils/tool/DrawUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -851,11 +851,13 @@ export default class DrawUtils {
points,
size,
defaultRGBA,
pixelSize = 13,
}: {
canvas: HTMLCanvasElement;
points: IPixelPoints[];
size: ISize;
defaultRGBA?: string;
pixelSize?: number;
}) {
const ctx = canvas.getContext('2d')!;
const { width, height } = size;
Expand All @@ -868,10 +870,7 @@ export default class DrawUtils {
imageData.data[baseIndex + 3] = Math.floor(255 * alpha);
};

const maxSize = Math.max(width, height);
const pixelSize = Math.floor(Math.pow(MathUtils.calculateThousandsPlace(maxSize), 2));
const offsetArr = MathUtils.generateCoordinates(pixelSize);

points.forEach((item) => {
for (const [x, y] of offsetArr) {
const baseIndex = (item.y + y) * (imageData.width * 4) + (item.x + x) * 4;
Expand Down

0 comments on commit 206476c

Please sign in to comment.