@momo2555/koppeliajs 0.0.118 → 0.0.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { routeType } from '../stores/routeStore.js';
|
|
3
|
+
import { Koppelia } from '../scripts/koppelia.js';
|
|
4
|
+
|
|
5
|
+
export let id: string = '';
|
|
6
|
+
export let defaultFontSize: number = 10;
|
|
7
|
+
|
|
8
|
+
$: fontSize = defaultFontSize;
|
|
9
|
+
|
|
10
|
+
let koppelia = Koppelia.instance;
|
|
11
|
+
|
|
12
|
+
koppelia.onReady(async () => {
|
|
13
|
+
await koppelia.registerNewResizableText(id, fontSize, (newFontSize: number) => {
|
|
14
|
+
fontSize = newFontSize;
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div class="resizable-text" id="resizable-text-{id}" style="font-size: {fontSize}px;">
|
|
21
|
+
<slot />
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
|
|
26
|
+
</style>
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
export default ResizableText;
|
|
2
|
-
type ResizableText = SvelteComponent<{
|
|
3
|
-
[x: string]: never;
|
|
4
|
-
}, {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {}> & {
|
|
7
|
-
$$bindings?: string | undefined;
|
|
8
|
-
};
|
|
9
|
-
declare const ResizableText: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
-
[x: string]: never;
|
|
11
|
-
}, {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {}, {}, string>;
|
|
14
1
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
-
new (options: import(
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
16
3
|
$$bindings?: Bindings;
|
|
17
4
|
} & Exports;
|
|
18
|
-
(internal: unknown, props: {
|
|
5
|
+
(internal: unknown, props: Props & {
|
|
19
6
|
$$events?: Events;
|
|
20
7
|
$$slots?: Slots;
|
|
21
8
|
}): Exports & {
|
|
@@ -24,3 +11,20 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
24
11
|
};
|
|
25
12
|
z_$$bindings?: Bindings;
|
|
26
13
|
}
|
|
14
|
+
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
15
|
+
default: any;
|
|
16
|
+
} ? Props extends Record<string, never> ? any : {
|
|
17
|
+
children?: any;
|
|
18
|
+
} : {});
|
|
19
|
+
declare const ResizableText: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
20
|
+
id?: string;
|
|
21
|
+
defaultFontSize?: number;
|
|
22
|
+
}, {
|
|
23
|
+
default: {};
|
|
24
|
+
}>, {
|
|
25
|
+
[evt: string]: CustomEvent<any>;
|
|
26
|
+
}, {
|
|
27
|
+
default: {};
|
|
28
|
+
}, {}, string>;
|
|
29
|
+
type ResizableText = InstanceType<typeof ResizableText>;
|
|
30
|
+
export default ResizableText;
|
|
@@ -57,7 +57,7 @@ export declare class Koppelia {
|
|
|
57
57
|
*/
|
|
58
58
|
getCurrentPlay(): Promise<Play>;
|
|
59
59
|
/**
|
|
60
|
-
* This function enables the difficulty cursor, to change the difficulty
|
|
60
|
+
* This function enables the difficulty cursor, to change the difficulty live when playing from Koppeli'App
|
|
61
61
|
* @param callback : callback to call when difficulty changes
|
|
62
62
|
*/
|
|
63
63
|
enableDifficultyCursor(callback: (difficulty: number) => void): Promise<void>;
|
|
@@ -73,4 +73,8 @@ export declare class Koppelia {
|
|
|
73
73
|
* @param grown
|
|
74
74
|
*/
|
|
75
75
|
updateGrowableElement(id: string, grown: boolean): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
registerNewResizableText(id: string, defaultSize: number, onTextResized: (newSize: number) => void): Promise<void>;
|
|
76
80
|
}
|
package/dist/scripts/koppelia.js
CHANGED
|
@@ -157,7 +157,7 @@ export class Koppelia {
|
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
/**
|
|
160
|
-
* This function enables the difficulty cursor, to change the difficulty
|
|
160
|
+
* This function enables the difficulty cursor, to change the difficulty live when playing from Koppeli'App
|
|
161
161
|
* @param callback : callback to call when difficulty changes
|
|
162
162
|
*/
|
|
163
163
|
async enableDifficultyCursor(callback) {
|
|
@@ -211,4 +211,32 @@ export class Koppelia {
|
|
|
211
211
|
});
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
*
|
|
216
|
+
*/
|
|
217
|
+
async registerNewResizableText(id, defaultSize, onTextResized) {
|
|
218
|
+
return new Promise((resolve, reject) => {
|
|
219
|
+
if (get(routeType) == "controller") {
|
|
220
|
+
let addGrowableElRequest = new Message();
|
|
221
|
+
addGrowableElRequest.setRequest("addResizableText");
|
|
222
|
+
addGrowableElRequest.addParam("id", id);
|
|
223
|
+
addGrowableElRequest.addParam("defaultSize", defaultSize);
|
|
224
|
+
addGrowableElRequest.setDestination(PeerType.MASTER, "");
|
|
225
|
+
// send the message to the console (only the controller sends the )
|
|
226
|
+
this._console.sendMessage(addGrowableElRequest, (response) => {
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
this._console.onRequest((req, params) => {
|
|
230
|
+
if (req == "resizableTextNotification") {
|
|
231
|
+
if (params.id !== undefined && params.id == id) {
|
|
232
|
+
let fontSize = defaultSize;
|
|
233
|
+
if (params.fontSize != undefined)
|
|
234
|
+
fontSize = params.fontSize;
|
|
235
|
+
onTextResized(fontSize);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
resolve();
|
|
240
|
+
});
|
|
241
|
+
}
|
|
214
242
|
}
|