Sign in

    mizchi/moonlight/core does not have a README file

    AnchorDragState

    pub(all) struct AnchorDragState {
    source_element_id : String
    source_anchor_type : AnchorType
    source_x : Double
    source_y : Double
    current_x : Double
    current_y : Double
    }

    アンカードラッグ状態(アンカーから線を描画中)

    AnchorType

    pub(all) enum AnchorType {
    Top
    Bottom
    Left
    Right
    Center
    LineStart
    LineEnd
    }

    アンカータイプ(アンカーポイントの位置)

    EditorMode

    pub(all) enum EditorMode {
    Full
    Embedded
    }

    エディタモード

    EditorState

    pub struct EditorState {
    width : Int
    height : Int
    canvas_width :
    Signal
    [Int]
    canvas_height :
    Signal
    [Int]
    doc_width :
    Signal
    [Double]
    doc_height :
    Signal
    [Double]
    elements :
    Signal
    [Array[
    Element
    ]]
    selected_ids :
    Signal
    [Array[String]]
    drag_state :
    Signal
    [
    DragState
    ?]
    multi_drag_state :
    Signal
    [
    MultiDragState
    ?]
    resize_state :
    Signal
    [
    ResizeState
    ?]
    box_select :
    Signal
    [
    BoxSelectState
    ?]
    context_menu :
    Signal
    [
    ContextMenu
    ?]
    viewport :
    Signal
    [
    Viewport
    ]
    grid_enabled :
    Signal
    [Bool]
    grid_size :
    Signal
    [Int]
    is_panning :
    Signal
    [Bool]
    pan_start :
    Signal
    [(Double, Double)?]
    text_edit :
    Signal
    [
    TextEditState
    ?]
    pending_connection :
    Signal
    [PendingConnection?]
    placement_state :
    Signal
    [PlacementState?]
    mouse_scene_pos :
    Signal
    [
    Point
    ]
    mouse_in_canvas :
    Signal
    [Bool]
    preview_bg :
    Signal
    [String]
    embed_bg :
    Signal
    [String]
    theme_mode :
    Signal
    [
    ThemeMode
    ]
    is_mobile :
    Signal
    [Bool]
    panel_visible :
    Signal
    [Bool]
    mode : EditorMode
    modal_open :
    Signal
    [Bool]
    has_focus :
    Signal
    [Bool]
    is_readonly :
    Signal
    [Bool]
    show_toolbar :
    Signal
    [Bool]
    anchor_drag_state :
    Signal
    [AnchorDragState?]
    svg_el :
    Signal
    [
    Any
    ]
    container_el :
    Signal
    [
    Any
    ]
    tool_mode :
    Signal
    [ToolMode]
    free_draw_state :
    Signal
    [FreeDrawState?]
    free_draw_options :
    Signal
    [FreeDrawOptions]
    last_placement_pos :
    Signal
    [
    Point
    ?]
    pinch_state :
    Signal
    [PinchState?]
    validation_result :
    Signal
    [
    ValidationResult
    ?]
    plain_svg_ids :
    Signal
    [Array[String]]
    }

    エディタの状態

    EditorState::add_element

    fn EditorState::add_element(self : EditorState, element :
    Element
    ) -> Unit

    要素を追加(無効な要素は追加しない)

    EditorState::add_element_raw

    fn EditorState::add_element_raw(self : EditorState, element :
    Element
    ) -> Unit

    要素を追加(履歴なし、無効な要素は追加しない)

    EditorState::add_to_selection

    fn EditorState::add_to_selection(self : EditorState, id : String) -> Unit

    選択に追加

    EditorState::bring_forward

    fn EditorState::bring_forward(self : EditorState, id : String) -> (Int, Int)?

    要素を1つ前面に移動

    EditorState::bring_to_front

    fn EditorState::bring_to_front(self : EditorState, id : String) -> (Int, Int)?

    要素を最前面に移動

    EditorState::can_edit_element

    fn EditorState::can_edit_element(self : EditorState, element_id : String) -> Bool

    指定要素が編集可能かどうか

    EditorState::can_resize_element

    fn EditorState::can_resize_element(self : EditorState, element_id : String) -> Bool

    指定要素がリサイズ可能かどうか

    EditorState::cancel_placement

    fn EditorState::cancel_placement(self : EditorState) -> Unit

    配置モードをキャンセル(要素を削除)

    EditorState::center_child_elements

    fn EditorState::center_child_elements(self : EditorState, parent_id : String) -> Unit

    親要素の子テキストを中央に配置

    EditorState::clear_plain_svg_ids

    fn EditorState::clear_plain_svg_ids(self : EditorState) -> Unit

    プレーンSVG要素をクリア

    EditorState::delete_selected

    fn EditorState::delete_selected(self : EditorState) -> Unit

    選択中の要素を削除

    EditorState::drag_move

    fn EditorState::drag_move(self : EditorState, mouse_x : Double, mouse_y : Double) -> Unit

    ドラッグ中の移動

    EditorState::end_box_select

    fn EditorState::end_box_select(self : EditorState) -> Unit

    矩形選択を終了し、範囲内の要素を選択

    EditorState::end_drag

    fn EditorState::end_drag(self : EditorState) -> Unit

    ドラッグ終了

    EditorState::end_multi_drag

    fn EditorState::end_multi_drag(self : EditorState) -> Unit

    複数要素のドラッグを終了

    EditorState::end_pan

    fn EditorState::end_pan(self : EditorState) -> Unit

    パン終了

    EditorState::end_pinch

    fn EditorState::end_pinch(self : EditorState, pointer_id : Int) -> Unit

    ピンチズームを終了

    EditorState::end_placement

    fn EditorState::end_placement(self : EditorState) -> Unit

    配置モードを終了(確定)

    EditorState::end_resize

    fn EditorState::end_resize(self : EditorState) -> Unit

    リサイズ終了

    EditorState::end_text_edit

    fn EditorState::end_text_edit(self : EditorState) -> Unit

    テキスト編集を終了

    EditorState::find_element

    fn EditorState::find_element(self : EditorState, id : String) ->
    Element
    ?

    要素を ID で検索

    EditorState::find_nearest_connection_point

    指定座標から最も近い接続ポイントを探す(全要素から)

    EditorState::fit_to_canvas

    fn EditorState::fit_to_canvas(self : EditorState) -> Unit

    ドキュメント全体がキャンバスにフィットする zoom を計算してセット

    EditorState::get_arrow_style

    Arrow用のスタイルを取得(CSS変数を使用)

    EditorState::get_arrow_style_initial

    fn EditorState::get_arrow_style_initial(_self : EditorState) ->
    Style

    Arrow用のスタイルを取得(矢印なし - 配置モード初期用)

    EditorState::get_children

    fn EditorState::get_children(self : EditorState, parent_id : String) -> Array[
    Element
    ]

    指定要素の子要素を取得

    EditorState::get_default_style

    テーマに基づいたデフォルトスタイルを取得(CSS変数を使用)

    EditorState::get_element_capability

    fn EditorState::get_element_capability(self : EditorState, element_id : String) ->
    ElementCapability

    指定要素の操作権限を取得

    EditorState::get_element_index

    fn EditorState::get_element_index(self : EditorState, id : String) -> Int?

    要素の現在のインデックスを取得

    EditorState::get_line_style

    Line用のスタイルを取得(CSS変数を使用)

    EditorState::get_parent_id

    fn EditorState::get_parent_id(self : EditorState, id : String) -> String?

    子要素の親を取得

    EditorState::get_placement_position

    fn EditorState::get_placement_position(self : EditorState) ->
    Point

    要素配置位置を取得(マウスがキャンバス内ならマウス位置、そうでなければ画面中央) 同じ座標に繰り返し配置する場合は +15px ずらす

    EditorState::get_selected_id

    fn EditorState::get_selected_id(self : EditorState) -> String?

    最初の選択要素を取得(後方互換性用)

    EditorState::get_text_style

    テーマに基づいたテキストスタイルを取得(CSS変数を使用)

    EditorState::get_theme

    現在のテーマを取得

    EditorState::get_viewport_center

    ビューポートの中央座標を取得(シーン座標)

    EditorState::has_element_with_id

    fn EditorState::has_element_with_id(self : EditorState, id : String) -> Bool

    指定IDの要素が存在するかチェック

    EditorState::hide_context_menu

    fn EditorState::hide_context_menu(self : EditorState) -> Unit

    コンテキストメニューを非表示

    EditorState::hit_test

    fn EditorState::hit_test(self : EditorState, x : Double, y : Double) ->
    Element
    ?

    指定座標にある要素を検索(上から順に)

    EditorState::is_box_selecting

    fn EditorState::is_box_selecting(self : EditorState) -> Bool

    矩形選択中かどうか

    EditorState::is_child_element

    fn EditorState::is_child_element(self : EditorState, id : String) -> Bool

    要素が子要素かどうか判定

    EditorState::is_dragging

    fn EditorState::is_dragging(self : EditorState) -> Bool

    ドラッグ中かどうか

    EditorState::is_multi_dragging

    fn EditorState::is_multi_dragging(self : EditorState) -> Bool

    複数要素ドラッグ中かどうか

    EditorState::is_pinching

    fn EditorState::is_pinching(self : EditorState) -> Bool

    ピンチ中かどうか

    EditorState::is_placing

    fn EditorState::is_placing(self : EditorState) -> Bool

    配置モード中かどうか

    EditorState::is_resizing

    fn EditorState::is_resizing(self : EditorState) -> Bool

    リサイズ中かどうか

    EditorState::is_selected

    fn EditorState::is_selected(self : EditorState, id : String) -> Bool

    選択されているか判定

    EditorState::move_element

    fn EditorState::move_element(self : EditorState, id : String, new_x : Double, new_y : Double) -> Unit

    要素を移動(子要素も一緒に移動、接続ラインも更新) model 層の純粋関数を使用してアトミックに更新

    EditorState::multi_drag_move

    fn EditorState::multi_drag_move(self : EditorState, mouse_x : Double, mouse_y : Double) -> Unit

    複数要素のドラッグ中の移動

    EditorState::new

    fn EditorState::new(width : Int, height : Int) -> EditorState

    エディタ状態を作成

    EditorState::new_with_mode

    fn EditorState::new_with_mode(width : Int, height : Int, mode : EditorMode) -> EditorState

    指定モードでエディタ状態を作成

    EditorState::pan

    fn EditorState::pan(self : EditorState, dx : Double, dy : Double) -> Unit

    パン(スクロール)

    EditorState::pan_move

    fn EditorState::pan_move(self : EditorState, screen_x : Double, screen_y : Double) -> Unit

    パン移動

    EditorState::register_plain_svg_ids

    fn EditorState::register_plain_svg_ids(self : EditorState, ids : Array[String]) -> Unit

    プレーンSVG要素を登録

    EditorState::remove_element

    fn EditorState::remove_element(self : EditorState, id : String) -> Unit

    要素を削除

    EditorState::remove_element_raw

    fn EditorState::remove_element_raw(self : EditorState, id : String) -> Unit

    要素を削除(履歴なし、子要素も削除)

    EditorState::remove_from_selection

    fn EditorState::remove_from_selection(self : EditorState, id : String) -> Unit

    選択から除外

    EditorState::rename_element_id

    fn EditorState::rename_element_id(self : EditorState, old_id : String, new_id : String) -> Bool

    要素のIDを変更(衝突チェック付き) 成功時は true、ID衝突時は false を返す

    EditorState::rename_element_raw

    fn EditorState::rename_element_raw(self : EditorState, old_id : String, new_id : String) -> Unit

    要素のIDを変更(履歴なし、衝突チェックなし)

    EditorState::reorder_element_raw

    fn EditorState::reorder_element_raw(self : EditorState, id : String, to_index : Int) -> Unit

    要素を指定位置に移動(履歴なし)

    EditorState::reset_viewport

    fn EditorState::reset_viewport(self : EditorState) -> Unit

    ビューポートをリセット

    EditorState::resize_move

    fn EditorState::resize_move(self : EditorState, mouse_x : Double, mouse_y : Double) -> Unit

    リサイズ中の移動

    EditorState::revalidate

    fn EditorState::revalidate(self : EditorState) -> Unit

    全要素を再バリデーションして結果を保存

    EditorState::select

    fn EditorState::select(self : EditorState, id : String?) -> Unit

    要素を選択(単一)

    EditorState::select_all

    fn EditorState::select_all(self : EditorState) -> Unit

    全要素を選択(Line と子要素以外)

    EditorState::select_multiple

    fn EditorState::select_multiple(self : EditorState, ids : Array[String]) -> Unit

    複数要素を選択

    EditorState::send_backward

    fn EditorState::send_backward(self : EditorState, id : String) -> (Int, Int)?

    要素を1つ背面に移動

    EditorState::send_to_back

    fn EditorState::send_to_back(self : EditorState, id : String) -> (Int, Int)?

    要素を最背面に移動

    EditorState::show_context_menu

    fn EditorState::show_context_menu(self : EditorState, x : Double, y : Double, scene_x : Double, scene_y : Double, target_id : String?) -> Unit

    コンテキストメニューを表示

    EditorState::snap_to_grid

    fn EditorState::snap_to_grid(self : EditorState, x : Double, y : Double) -> (Double, Double)

    座標をグリッドにスナップ

    EditorState::start_box_select

    fn EditorState::start_box_select(self : EditorState, x : Double, y : Double) -> Unit

    矩形選択を開始

    EditorState::start_drag

    fn EditorState::start_drag(self : EditorState, element_id : String, mouse_x : Double, mouse_y : Double) -> Unit

    ドラッグ開始

    EditorState::start_multi_drag

    fn EditorState::start_multi_drag(self : EditorState, mouse_x : Double, mouse_y : Double) -> Unit

    複数要素のドラッグを開始

    EditorState::start_pan

    fn EditorState::start_pan(self : EditorState, screen_x : Double, screen_y : Double) -> Unit

    パン開始

    EditorState::start_pinch

    fn EditorState::start_pinch(self : EditorState, pointer1_id : Int, pointer2_id : Int, p1 :
    Point
    , p2 :
    Point
    ) -> Unit

    ピンチズームを開始

    EditorState::start_placement

    fn EditorState::start_placement(self : EditorState, element_id : String, anchor_element_id : String, anchor :
    Anchor
    , anchor_point :
    Point
    , is_line : Bool, is_arrow? : Bool) -> Unit

    配置モードを開始

    EditorState::start_resize

    fn EditorState::start_resize(self : EditorState, element_id : String, handle :
    HandlePosition
    , mouse_x : Double, mouse_y : Double) -> Unit

    リサイズ開始

    EditorState::start_text_edit

    fn EditorState::start_text_edit(self : EditorState, parent_id : String, x : Double, y : Double) -> Unit

    テキスト編集を開始(新規作成)

    EditorState::start_text_edit_existing

    fn EditorState::start_text_edit_existing(self : EditorState, text_id : String, parent_id : String, x : Double, y : Double, initial_text : String, font_size : Double?) -> Unit

    テキスト編集を開始(既存テキストの編集)
    fn EditorState::sync_related_elements(self : EditorState, element_id : String) -> Unit

    要素の変更後に関連する要素を同期更新
    • 子要素(テキストなど)を親の中央に再配置
    • 接続されているラインの端点を更新

    EditorState::toggle_grid

    fn EditorState::toggle_grid(self : EditorState) -> Unit

    グリッドスナップを切り替え

    EditorState::update_box_select

    fn EditorState::update_box_select(self : EditorState, x : Double, y : Double) -> Unit

    矩形選択を更新

    EditorState::update_connected_lines

    fn EditorState::update_connected_lines(self : EditorState, element_id : String) -> Unit

    指定要素に接続されている全てのラインを更新(BFS で全ホップを伝播)

    EditorState::update_connected_lines_except

    fn EditorState::update_connected_lines_except(self : EditorState, element_id : String, except_line_id : String) -> Unit

    指定要素に接続されているラインを更新(特定のラインを除く、BFS で全ホップを伝播)

    EditorState::update_element

    fn EditorState::update_element(self : EditorState, id : String, updater : (
    Element
    ) ->
    Element
    ) -> Unit

    要素を更新

    EditorState::update_element_by_id

    fn EditorState::update_element_by_id(self : EditorState, id : String, updater : (
    Element
    ) ->
    Element
    ) -> Unit

    指定IDの要素を更新(汎用ヘルパー)

    EditorState::update_line_connection

    fn EditorState::update_line_connection(self : EditorState, line_id : String, connections :
    LineConnections
    ) -> Unit

    線の接続情報を更新

    EditorState::update_pinch

    fn EditorState::update_pinch(self : EditorState, pointer_id : Int, pos :
    Point
    ) -> Unit

    ピンチズームを更新

    EditorState::update_placement

    fn EditorState::update_placement(self : EditorState, mouse_pos :
    Point
    ) -> Unit

    配置モード中のマウス位置に応じて要素を更新

    EditorState::update_style_raw

    fn EditorState::update_style_raw(self : EditorState, id : String, new_style :
    Style
    ) -> Unit

    要素のスタイルを更新(履歴なし)

    EditorState::update_text_raw

    fn EditorState::update_text_raw(self : EditorState, id : String, new_content : String) -> Unit

    テキスト要素の内容を更新(履歴なし)

    EditorState::zoom_at

    fn EditorState::zoom_at(self : EditorState, screen_x : Double, screen_y : Double, zoom_in : Bool) -> Unit

    指定位置を基準にズーム(マウス位置中心)

    EditorState::zoom_in

    fn EditorState::zoom_in(self : EditorState) -> Unit

    ズームイン

    EditorState::zoom_out

    fn EditorState::zoom_out(self : EditorState) -> Unit

    ズームアウト

    FreeDrawOptions

    pub(all) struct FreeDrawOptions {
    resample_dist : Double
    epsilon : Double
    max_error : Double
    }

    フリードローオプション

    FreeDrawState

    pub(all) struct FreeDrawState {
    points : Array[
    Point
    ]
    }

    フリードロー状態(描画中の点群)

    PendingConnection

    pub(all) struct PendingConnection {
    target_id : String
    anchor :
    Anchor

    point :
    Point

    }

    線のスナップ先プレビュー(ドラッグ中の視覚的フィードバック用)

    PinchState

    pub struct PinchState {
    pointer1_id : Int
    pointer2_id : Int
    pointer1_pos :
    Point

    pointer2_pos :
    Point

    initial_distance : Double
    initial_zoom : Double
    center :
    Point

    }

    ピンチズーム状態

    PlacementState

    pub(all) struct PlacementState {
    element_id : String
    anchor_element_id : String
    anchor :
    Anchor

    anchor_point :
    Point

    is_line : Bool
    is_arrow : Bool
    has_moved : Bool
    }

    配置モード状態(ショートカットキーからの要素挿入時)

    ToolMode

    pub(all) enum ToolMode {
    Select
    FreeDraw
    }

    ツールモード
    impl Eq for ToolMode
    impl Show for ToolMode

    execute_command

    fn execute_command(history :
    History
    , state : EditorState, command :
    Command
    ) -> Unit

    コマンドを実行して履歴に追加

    redo_command

    fn redo_command(history :
    History
    , state : EditorState) -> Bool

    Redo(やり直し)

    undo_command

    fn undo_command(history :
    History
    , state : EditorState) -> Bool

    Undo(取り消し)

    Source Files