diff --git a/src/label/LabelManager.ts b/src/label/LabelManager.ts index 5c513b73bc..55384b2756 100644 --- a/src/label/LabelManager.ts +++ b/src/label/LabelManager.ts @@ -425,24 +425,24 @@ class LabelManager { } - if (layoutOption.draggable) { - label.draggable = true; - label.cursor = 'move'; - if (hostEl) { - let hostModel: Model = - labelItem.seriesModel as SeriesModel; - if (labelItem.dataIndex != null) { - const data = labelItem.seriesModel.getData(labelItem.dataType); - hostModel = data.getItemModel(labelItem.dataIndex); - } - label.on('drag', createDragHandler(hostEl, hostModel.getModel('labelLine'))); + } + if (layoutOption.draggable) { + label.draggable = true; + label.cursor = 'move'; + if (hostEl) { + let hostModel: Model = + labelItem.seriesModel as SeriesModel; + if (labelItem.dataIndex != null) { + const data = labelItem.seriesModel.getData(labelItem.dataType); + hostModel = data.getItemModel(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; } } }