Skip to content

Commit

Permalink
handle "none" attribute types
Browse files Browse the repository at this point in the history
also remove some properties that only occurred in a single file
  • Loading branch information
scytacki committed Dec 12, 2024
1 parent 99b88fc commit 58a7c69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
9 changes: 3 additions & 6 deletions v3/src/components/graph/v2-graph-importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,9 @@ export function v2GraphImporter({v2Component, v2Document, sharedModelManager, in
attribute = v2Document.getV3Attribute(v2AttrId),
v3AttrId = attribute?.id ?? '',
v2Role = v2Component.componentStorage[`${attrKey}Role`],
v2Type = v2Component.componentStorage[`${attrKey}AttributeType`],
// TODO_V2_IMPORT If v2Type is 0 then v3Type will be 0 and the if block below will be skipped
// v3TypeFromV2TypeIndex refers to a "type eNone === 0" which in v3 is supposed to be undefined.
// So perhaps we should handle a v2Type of 0, and enter the if block to create the attribute description?
v3Type = v2Type && v3TypeFromV2TypeIndex[v2Type]
if (v3AttrRole && v3AttrId && v3Type) {
v2Type = v2Component.componentStorage[`${attrKey}AttributeType`]
if (v2Type != null && v3AttrRole && v3AttrId) {
const v3Type = v3TypeFromV2TypeIndex[v2Type]
const v2PrimaryNumeric = 1
const v2PrimaryCategorical = 3
if (["x", "y"].includes(attrKey) && (v2Role === v2PrimaryNumeric || v2Role === v2PrimaryCategorical)) {
Expand Down
11 changes: 6 additions & 5 deletions v3/src/v2/codap-v2-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,11 +853,12 @@ export interface ICodapV2BaseComponent {
// based on the results for `right`, this must be optional
y?: number

// these *Orig properties only occur in a single file in cfm-shared
leftOrig?: number
topOrig?: number
widthOrig?: number
heightOrig?: number
// These *Orig properties only occur in a single file in cfm-shared
// They are retained here incase we review the files in cfm-shared again
// leftOrig?: number
// topOrig?: number
// widthOrig?: number
// heightOrig?: number
}
savedHeight?: number | null
}
Expand Down

0 comments on commit 58a7c69

Please sign in to comment.