chart-0714
Version:
Professional trading chart library with advanced customization for trading journal apps
90 lines (89 loc) • 2.31 kB
TypeScript
import { DrawingObject, ChartPoint } from '../../types';
import { UnifiedCoordinateSystem } from '../../core/UnifiedCoordinateSystem';
export interface TextStyle {
fontSize: number;
fontFamily: string;
color: string;
bold: boolean;
italic: boolean;
underline: boolean;
backgroundColor?: string;
borderColor?: string;
borderWidth?: number;
padding?: number;
}
export interface TextObject extends DrawingObject {
type: 'text';
text: string;
textStyle?: TextStyle;
}
export declare class TextRenderer {
private container;
private textElements;
private coordSystem;
private debugLogged;
private onStyleEdit?;
private isEditing;
constructor(container: HTMLElement, coordSystem: UnifiedCoordinateSystem);
private createTextContainer;
/**
* 텍스트 객체 렌더링
*/
renderText(textObject: TextObject): void;
/**
* 새 텍스트 생성 및 즉시 편집 모드
*/
createAndEditText(point: ChartPoint, style: TextStyle, onComplete: (text: string) => void): void;
/**
* 텍스트 요소 생성
*/
private createTextElement;
/**
* 텍스트 위치 업데이트
*/
private updateTextPosition;
/**
* 텍스트 스타일 업데이트
*/
private updateTextStyle;
/**
* 모든 텍스트 재렌더링 (줌/패닝 시)
*/
updateAllPositions(textObjects: TextObject[]): void;
/**
* 텍스트 제거
*/
removeText(id: string): void;
/**
* 모든 텍스트 제거
*/
clear(): void;
/**
* 텍스트 선택 상태 업데이트
*/
updateSelection(id: string, selected: boolean): void;
/**
* 편집 모드 활성화
*/
enableEdit(id: string, onComplete: (text: string) => void): void;
/**
* 더블클릭 핸들러
*/
private handleDoubleClick;
/**
* 스타일 편집 콜백 설정
*/
setStyleEditCallback(callback: (id: string, currentStyle: TextStyle) => void): void;
/**
* ID로 텍스트 객체 가져오기 (외부 관리자에서 호출)
*/
private getTextObjectById;
/**
* 편집 중인지 확인
*/
isTextEditing(): boolean;
/**
* 컨테이너 정리
*/
dispose(): void;
}