Skip to content

Commit 73390de

Browse files
committed
fix jumping when dragging color picker
1 parent 7d01e08 commit 73390de

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/plugins/global-settings/color-schemes/color-scheme-picker.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -236,22 +236,24 @@ const ColorSchemePicker = props => {
236236
}
237237
}
238238

239-
const currentItem = cloneDeep( itemInEdit )
239+
setItemInEdit( prevItem => {
240+
const currentItem = prevItem
240241

241-
if ( ! schemeHasValue( currentItem.colorScheme ) && changeDefaultName ) {
242-
currentItem.name = currentItem?.key === 'scheme-default-1' ? 'Color Scheme 1' : 'Color Scheme 2'
243-
}
242+
if ( ! schemeHasValue( currentItem.colorScheme ) && changeDefaultName ) {
243+
currentItem.name = currentItem?.key === 'scheme-default-1' ? 'Color Scheme 1' : 'Color Scheme 2'
244+
}
244245

245-
currentItem.colorScheme[ property ][ currentState ] = color
246+
currentItem.colorScheme[ property ][ currentState ] = color
246247

247-
if ( property === 'backgroundColor' && isGradient( color ) ) {
248-
currentItem.colorScheme[ property ].desktopHover = ''
249-
currentItem.colorScheme[ property ].desktopParentHover = ''
250-
}
248+
if ( property === 'backgroundColor' && isGradient( color ) ) {
249+
currentItem.colorScheme[ property ].desktopHover = ''
250+
currentItem.colorScheme[ property ].desktopParentHover = ''
251+
}
251252

252-
setItemInEdit( currentItem )
253+
updateColorSchemes( currentItem )
253254

254-
updateColorSchemes( currentItem )
255+
return currentItem
256+
} )
255257
}
256258

257259
// For updating option to show the color scheme in color pickers

0 commit comments

Comments
 (0)