Skip to content

Commit

Permalink
Fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
tuanchauict committed Dec 17, 2024
1 parent d003a25 commit db4c3cb
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class ShapeExtraManagerImpl {
textVerticalAlign ?? this.defaultTextAlign.verticalAlign,
);

this.defaultExtraStateUpdateMutableFlow.value = this.defaultExtraStateUpdateFlow.value!! + 1;
this.defaultExtraStateUpdateMutableFlow.value = this.defaultExtraStateUpdateFlow.value! + 1;
}

getRectangleFillStyle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
let dashPattern: StrokeDashPattern | null | undefined = viewModel.shapeBorderDashTypeFlow.value;
function onItemSelect(id: string | null) {
viewModel.update(OneTimeAction.ChangeShapeBorderExtra({newBorderStyleId: id, isEnabled: id !== null}));
viewModel.update(OneTimeAction.ChangeShapeBorderExtra({ newBorderStyleId: id, isEnabled: id !== null }));
}
function onCornerRoundedChange(value: boolean) {
Expand Down Expand Up @@ -58,4 +58,4 @@
{dashPattern}
{onDashPatternChange}
/>
{/if}
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
});
function onItemSelect(id: string | null) {
viewModel.update(OneTimeAction.ChangeShapeFillExtra({isEnabled: id !== null, newFillStyleId: id}));
viewModel.update(OneTimeAction.ChangeShapeFillExtra({ isEnabled: id !== null, newFillStyleId: id }));
}
</script>
{#if shapeFillToolSelectionState}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
let dashPattern: StrokeDashPattern | null | undefined = viewModel.lineStrokeDashTypeFlow.value;
function onItemSelect(id: string | null) {
viewModel.update(OneTimeAction.ChangeLineStrokeExtra({newStrokeStyleId: id, isEnabled: id !== null}));
viewModel.update(OneTimeAction.ChangeLineStrokeExtra({ newStrokeStyleId: id, isEnabled: id !== null }));
}
function onCornerRoundedChange(value: boolean) {
Expand Down Expand Up @@ -57,4 +57,4 @@
{dashPattern}
{onDashPatternChange}
/>
{/if}
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { SHAPE_TOOL_VIEWMODEL } from "$ui/pannel/shapetool/constants";
let viewModel: ShapeToolViewModel = getContext(SHAPE_TOOL_VIEWMODEL);
export let title: string;
export let selectedId: string;
export let selectedId: string | null;
function onItemSelect(id: string) {
function onItemSelect(id: string | null) {
selectedId = id;
}
</script>
Expand All @@ -21,7 +21,6 @@ function onItemSelect(id: string) {
<CloudItem
id="{option.id}"
selected="{option.id === selectedId}"
useDashBorder="{option.useDashBorder}"
onSelect="{onItemSelect}">{option.name}</CloudItem
>
{/each}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
let offset: number = dashPattern?.offset ?? 0;
function onChangeInternal() {
onChange({dash, gap, offset})
onChange({ dash, gap, offset });
}
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { LifecycleOwner } from "$libs/flow";
import { getContext, onDestroy, onMount } from "svelte";
import { SHAPE_TOOL_VIEWMODEL } from "$ui/pannel/shapetool/constants";
import { OneTimeAction } from "$mono/action-manager/one-time-actions";
let viewModel: ShapeToolViewModel = getContext(SHAPE_TOOL_VIEWMODEL);
Expand All @@ -16,7 +17,16 @@
let width = 0;
let isResizeable = viewModel.singleShapeResizeableFlow.value;
// TODO: Notify value changed to shape manager
function onChange() {
viewModel.update(
OneTimeAction.ChangeShapeBound({
newLeft: x,
newTop: y,
newWidth: width,
newHeight: height,
})
);
}
onMount(() => {
lifecycleOwner.onStart();
Expand Down Expand Up @@ -48,6 +58,7 @@
label="X"
bind:value="{x}"
boundIncludesLabel="{true}"
{onChange}
/>
</div>
<div class="cell">
Expand All @@ -57,13 +68,15 @@
minValue="{1}"
boundIncludesLabel="{true}"
isEnabled="{isResizeable}"
{onChange}
/>
</div>
<div class="cell">
<NumberTextField
label="Y"
bind:value="{y}"
boundIncludesLabel="{true}"
{onChange}
/>
</div>
<div class="cell">
Expand All @@ -73,6 +86,7 @@
minValue="{1}"
boundIncludesLabel="{true}"
isEnabled="{isResizeable}"
{onChange}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ import type { AbstractShape } from "$mono/shape/shape/abstract-shape";
import { Rectangle } from "$mono/shape/shape/rectangle";
import { Text } from "$mono/shape/shape/text";
import { LineAppearanceDataController } from "./line-appearance-data-controller";
import { type AppearanceOptionItem, type CloudItemSelectionState, type DashPattern, selectedOrDefault } from "./models";
import {
type AppearanceOptionItem,
type CloudItemSelectionState,
selectedOrDefault,
type StrokeDashPattern,
} from "./models";
import { RectangleAppearanceDataController } from "./rectangle-appearance-data-controller";

/**
Expand All @@ -37,7 +42,7 @@ export class ShapeToolViewModel {
public readonly shapeBorderRoundedCornerFlow: Flow<boolean | null>;

public readonly lineStrokeTypeFlow: Flow<CloudItemSelectionState | null>;
public readonly lineStrokeDashTypeFlow: Flow<DashPattern | null>;
public readonly lineStrokeDashTypeFlow: Flow<StrokeDashPattern | null>;
public readonly lineStrokeRoundedCornerFlow: Flow<boolean | null>;

public readonly lineStartHeadFlow: Flow<CloudItemSelectionState | null>;
Expand Down

0 comments on commit db4c3cb

Please sign in to comment.