mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-21 20:52:12 -03:00
Remove redundant comments and clean up logging code
This commit removes unnecessary and redundant comments from multiple JavaScript modules, streamlining the code and improving readability. No functional changes were made; only comment cleanup and minor formatting adjustments.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import {createModuleLogger} from "./LoggerUtils.js";
|
||||
import {withErrorHandling, createValidationError} from "../ErrorHandler.js";
|
||||
|
||||
// Inicjalizacja loggera dla modułu ImageUtils
|
||||
const log = createModuleLogger('ImageUtils');
|
||||
|
||||
export function validateImageData(data) {
|
||||
@@ -181,9 +179,9 @@ export const imageToTensor = withErrorHandling(async function(image) {
|
||||
|
||||
for (let i = 0; i < imageData.data.length; i += 4) {
|
||||
const pixelIndex = i / 4;
|
||||
data[pixelIndex * 3] = imageData.data[i] / 255; // R
|
||||
data[pixelIndex * 3 + 1] = imageData.data[i + 1] / 255; // G
|
||||
data[pixelIndex * 3 + 2] = imageData.data[i + 2] / 255; // B
|
||||
data[pixelIndex * 3] = imageData.data[i] / 255;
|
||||
data[pixelIndex * 3 + 1] = imageData.data[i + 1] / 255;
|
||||
data[pixelIndex * 3 + 2] = imageData.data[i + 2] / 255;
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -218,10 +216,10 @@ export const tensorToImage = withErrorHandling(async function(tensor) {
|
||||
const pixelIndex = i * 4;
|
||||
const tensorIndex = i * channels;
|
||||
|
||||
imageData.data[pixelIndex] = Math.round(data[tensorIndex] * 255); // R
|
||||
imageData.data[pixelIndex + 1] = Math.round(data[tensorIndex + 1] * 255); // G
|
||||
imageData.data[pixelIndex + 2] = Math.round(data[tensorIndex + 2] * 255); // B
|
||||
imageData.data[pixelIndex + 3] = 255; // A
|
||||
imageData.data[pixelIndex] = Math.round(data[tensorIndex] * 255);
|
||||
imageData.data[pixelIndex + 1] = Math.round(data[tensorIndex + 1] * 255);
|
||||
imageData.data[pixelIndex + 2] = Math.round(data[tensorIndex + 2] * 255);
|
||||
imageData.data[pixelIndex + 3] = 255;
|
||||
}
|
||||
|
||||
ctx.putImageData(imageData, 0, 0);
|
||||
@@ -251,16 +249,12 @@ export const resizeImage = withErrorHandling(async function(image, maxWidth, max
|
||||
|
||||
const originalWidth = image.width || image.naturalWidth;
|
||||
const originalHeight = image.height || image.naturalHeight;
|
||||
|
||||
// Oblicz nowe wymiary z zachowaniem proporcji
|
||||
const scale = Math.min(maxWidth / originalWidth, maxHeight / originalHeight);
|
||||
const newWidth = Math.round(originalWidth * scale);
|
||||
const newHeight = Math.round(originalHeight * scale);
|
||||
|
||||
canvas.width = newWidth;
|
||||
canvas.height = newHeight;
|
||||
|
||||
// Użyj wysokiej jakości skalowania
|
||||
ctx.imageSmoothingEnabled = true;
|
||||
ctx.imageSmoothingQuality = 'high';
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import {logger, LogLevel} from "../logger.js";
|
||||
* @returns {Object} Obiekt z metodami logowania
|
||||
*/
|
||||
export function createModuleLogger(moduleName, level = LogLevel.DEBUG) {
|
||||
// Konfiguracja loggera dla modułu
|
||||
logger.setModuleLevel(moduleName, level);
|
||||
|
||||
return {
|
||||
@@ -29,7 +28,6 @@ export function createModuleLogger(moduleName, level = LogLevel.DEBUG) {
|
||||
* @returns {Object} Obiekt z metodami logowania
|
||||
*/
|
||||
export function createAutoLogger(level = LogLevel.DEBUG) {
|
||||
// Próba automatycznego wykrycia nazwy modułu z stack trace
|
||||
const stack = new Error().stack;
|
||||
const match = stack.match(/\/([^\/]+)\.js/);
|
||||
const moduleName = match ? match[1] : 'Unknown';
|
||||
|
||||
Reference in New Issue
Block a user