diff --git a/Assets/StreamingAssets/ScrollView_Server/scroll_interaction/Drop_facts.js b/Assets/StreamingAssets/ScrollView_Server/scroll_interaction/Drop_facts.js index 0916b3d95a275c5ad66f8d877acde4a5eb7d7a7d..fb09f7cc3da4318525b8f10406098f051ebdad4e 100644 --- a/Assets/StreamingAssets/ScrollView_Server/scroll_interaction/Drop_facts.js +++ b/Assets/StreamingAssets/ScrollView_Server/scroll_interaction/Drop_facts.js @@ -1,11 +1,21 @@ /** - * @typedef Point + * @typedef point * @type {object} * @property {number} x * @property {number} y * @property {number} z */ +/** + * @typedef {Object} fact + * @property {string} id Fact id + * @property {string} s_type Fact type + * @property {string} label used in unity + * @property {string | null} _CustomLabel Custom label + * @property {boolean} hasCustomLabel + * @property {number} labelId + */ + /** * @property {Point} point * @property {Point} normal @@ -122,7 +132,7 @@ function dropHandler(event) { //const data = event.dataTransfer.getData("text/plain") console.log(`Dropped data: '${event.dataTransfer.types}'`, event.dataTransfer.types) - /** @type {Fact} */ + /** @type {fact} */ const fact = JSON.parse(data) console.warn(`Dropped Fact '${fact.label}':`, fact) diff --git a/Assets/StreamingAssets/ScrollView_Server/scroll_interaction/SetScrollContent.js b/Assets/StreamingAssets/ScrollView_Server/scroll_interaction/SetScrollContent.js index 7fcf8b06ea00a6bbd7b9346cfc9b912c2053c83a..d2ba962b9565fd2ba9eb8c6d816e47a88b7d4454 100644 --- a/Assets/StreamingAssets/ScrollView_Server/scroll_interaction/SetScrollContent.js +++ b/Assets/StreamingAssets/ScrollView_Server/scroll_interaction/SetScrollContent.js @@ -1,6 +1,32 @@ + +/** + * A MMT..whatever. Somewhere between the first and second "meta-" MMT had to leave common nomenclature behind + * @typedef {{kind : string, uri: string}} MMTReference + */ +/** + * Facts, as they are send by MMT. Not *quite* the same format as Unity uses \*sigh\*, and everything has shortened names to avoid five additional letters \*double sigh\* + * @typedef {Object} MMTFact + * @property {MMTReference} ref the reference MMT uses to identify this fact + * @property {string} label the human readable lable to display this fact. + * @property {?any} df the definition of the Fact. May be null for {@link MMTScroll.requiredFacts} + * @property {?MMTReference} tp the MMT type of this fact + * @property {string} kind since a Fact is a MMTThingy, they also have a {@link MMTReference.kind} + */ +/** + * @typedef {Object} MMTScroll + * @property {string} ref The MMT URI + * @property {string} label The human-readable name + * @property {string} description The description to be rendered here + * @property {MMTFact[]} requiredFacts List of all facts required to apply the scroll. If the scroll has been partially applied these Facts may be the assigned ones + * @property {MMTFact[]} acquiredFacts List of all facts that will be acquired when applying the scroll + * @property {string} name Unity artifact; The URI again + * @property {?string} path Unity artifact; will always be null + */ + let currentScrollRef = "" // ref of the scroll currently displayed function RenderScroll() { + /** @type {MMTScroll} */ const scroll = JSON.parse(document.querySelector("#Unity-Data-Interface").dataset.scrollDynamic); console.log(scroll.requiredFacts); const scrollContainer = document.querySelector("#scrollContainer");