@@ -106,9 +106,9 @@ export class BreastDiagram extends ConfigurableComponent {
106106 render ( ) {
107107 const { $imageMap, markers, values } = this
108108
109- values . forEach ( ( { id , x, y } , index ) => {
110- const $path = $imageMap . getPathById ( id )
111- const point = $imageMap . createPoint ( x , y , id )
109+ values . forEach ( ( { region_id , x, y } , index ) => {
110+ const $path = $imageMap . getPathById ( region_id )
111+ const point = $imageMap . createPoint ( x , y , region_id )
112112
113113 // Render active region
114114 $imageMap . setState ( 'active' , $path )
@@ -180,7 +180,7 @@ export class BreastDiagram extends ConfigurableComponent {
180180 }
181181
182182 $debugInput . textContent =
183- this . values . map ( ( { id } ) => id ) . join ( ', ' ) || 'N/A'
183+ this . values . map ( ( { region_id } ) => region_id ) . join ( ', ' ) || 'N/A'
184184
185185 if ( ! $debugX || ! $debugY || ! $debugRegion ) {
186186 return
@@ -205,8 +205,8 @@ export class BreastDiagram extends ConfigurableComponent {
205205 }
206206
207207 this . add ( {
208- id : $path . classList . value ,
209- name : 'Pending' ,
208+ id : 'pending' ,
209+ region_id : $path . classList . value ,
210210 x : point . x ,
211211 y : point . y
212212 } )
@@ -242,7 +242,7 @@ export class BreastDiagram extends ConfigurableComponent {
242242 }
243243
244244 const index = values . indexOf ( entry )
245- const $path = $imageMap . getPathById ( entry . id )
245+ const $path = $imageMap . getPathById ( entry . region_id )
246246
247247 $imageMap . setState ( 'active' , $path , false )
248248 values . splice ( index , 1 )
@@ -343,10 +343,12 @@ function isValidObject(value) {
343343 return false
344344 }
345345
346+ const keys = new Set ( [ 'id' , 'region_id' , 'x' , 'y' ] )
347+
346348 return (
347- Object . keys ( value ) . every ( ( key ) => [ 'id' , 'name' , 'x' , 'y' ] . includes ( key ) ) &&
349+ Object . keys ( value ) . every ( ( key ) => keys . has ( key ) ) &&
348350 typeof value . id === 'string' &&
349- typeof value . name === 'string' &&
351+ typeof value . region_id === 'string' &&
350352 typeof value . x === 'number' &&
351353 typeof value . y === 'number'
352354 )
@@ -378,8 +380,8 @@ function isValid(value) {
378380 * Breast feature input value
379381 *
380382 * @typedef {object } BreastFeature
381- * @property {string } id - Image map region ID
382- * @property {string } name - Breast feature name
383+ * @property {string } id - Breast feature ID
384+ * @property {string } region_id - Image map region ID
383385 * @property {number } x - X coordinate of breast feature
384386 * @property {number } y - Y coordinate of breast feature
385387 */
0 commit comments