Skip to content

Commit

Permalink
refactor(label): move unrelated code outside the state loop
Browse files Browse the repository at this point in the history
  • Loading branch information
A0nameless0man committed Nov 6, 2024
1 parent d1b0d10 commit 931326a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/label/LabelManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,24 +425,24 @@ class LabelManager {
}


if (layoutOption.draggable) {
label.draggable = true;
label.cursor = 'move';
if (hostEl) {
let hostModel: Model<LabelLineOptionMixin> =
labelItem.seriesModel as SeriesModel<LabelLineOptionMixin>;
if (labelItem.dataIndex != null) {
const data = labelItem.seriesModel.getData(labelItem.dataType);
hostModel = data.getItemModel<LabelLineOptionMixin>(labelItem.dataIndex);
}
label.on('drag', createDragHandler(hostEl, hostModel.getModel('labelLine')));
}
if (layoutOption.draggable) {
label.draggable = true;
label.cursor = 'move';
if (hostEl) {
let hostModel: Model<LabelLineOptionMixin> =
labelItem.seriesModel as SeriesModel<LabelLineOptionMixin>;
if (labelItem.dataIndex != null) {
const data = labelItem.seriesModel.getData(labelItem.dataType);
hostModel = data.getItemModel<LabelLineOptionMixin>(labelItem.dataIndex);
}
label.on('drag', createDragHandler(hostEl, hostModel.getModel('labelLine')));
}
else {
// TODO Other drag functions?
label.off('drag');
label.cursor = defaultLabelAttr.cursor;
}
}
else {
// TODO Other drag functions?
label.off('drag');
label.cursor = defaultLabelAttr.cursor;
}
}
}
Expand Down

0 comments on commit 931326a

Please sign in to comment.