本文整理汇总了TypeScript中eez-studio-shared/model/store.DocumentStore类的典型用法代码示例。如果您正苦于以下问题:TypeScript DocumentStore类的具体用法?TypeScript DocumentStore怎么用?TypeScript DocumentStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DocumentStore类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: deleteDragItem
deleteDragItem() {
if (this.dropObject && this.dropEffect == "move") {
if (this.dragObject) {
DocumentStore.deleteObject(this.dragObject);
}
this.dropEffect = undefined;
this.dragItemDeleted = true;
}
}
示例2: unsetResolutionDependablePropertyForCurrentResolution
export function unsetResolutionDependablePropertyForCurrentResolution(
object: EezObject,
propertyName: string
) {
const allValues: (any | null)[] = getPropertyValueForAllResolutions(object, propertyName);
allValues[getPageContext().resolution] = null;
while (allValues.length > 1 && allValues[allValues.length - 1] === null) {
allValues.pop();
}
DocumentStore.updateObject(object, {
[propertyName + "_"]: allValues
});
}
示例3: resetInObject
function resetInObject(object: EezObject) {
const changes: {
[key: string]: any;
} = {};
object._classInfo.properties.forEach(propertyInfo => {
if (propertyInfo.resolutionDependable) {
const value = getPropertyValueForAllResolutions(object, propertyInfo.name);
for (let i = getPageContext().resolution + 1; i < value.length; i++) {
value[i] = null;
}
changes[propertyInfo.name + "_"] = value;
}
});
DocumentStore.updateObject(object, changes);
getChildren(object).forEach(resetInObject);
}
示例4: replaceObjectReference
export function replaceObjectReference(object: EezObject, newValue: string) {
let resultsGenerator = searchForReference(DocumentStore.document, object, false);
while (true) {
let searchResult = resultsGenerator.next();
if (searchResult.done) {
break;
}
let searchValue = searchResult.value;
if (searchValue) {
let value: string | string[] = newValue;
if (searchValue.propertyInfo.replaceObjectReference) {
value = searchValue.propertyInfo.replaceObjectReference(value);
} else if (searchValue.propertyInfo.type === PropertyType.ConfigurationReference) {
value = [];
for (let i = 0; i < searchValue.value.length; i++) {
if (searchValue.value[i] !== getProperty(object, "name")) {
value.push(searchValue.value[i]);
} else {
value.push(newValue);
}
}
}
let parent = searchValue._parent;
if (parent) {
let key = searchValue._key;
if (parent && key && typeof key == "string") {
DocumentStore.updateObject(parent, {
[key]: value
});
}
}
}
}
}