Skip to content

Commit

Permalink
新增poline-label组件拖拽回调函数
Browse files Browse the repository at this point in the history
  • Loading branch information
hinikai committed Nov 16, 2017
1 parent 83719ce commit b98a719
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/dist/react-bmap.min.js

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion docs/examples/build/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31821,6 +31821,9 @@ var App = function (_Component) {
this.props.data.forEach(function (item, index) {
var tip = new _DraggingTip2.default({
isShowTipArrow: true,
changePosition: function changePosition(point) {
_this2.props.changePosition && _this2.props.changePosition(point, index);
},
map: map,
numberDirection: item.numberDirection,
isShowNumber: item.isShowNumber,
Expand Down Expand Up @@ -31885,6 +31888,9 @@ function DraggingTip(options) {
tip.setPosition(marker.point);
options.change && options.change();
});
marker.addEventListener('dragend', function () {
options.changePosition && options.changePosition(self.point);
});
marker.enableDragging();
}

Expand Down Expand Up @@ -32373,7 +32379,11 @@ var App = function (_Component) {
lng: 116.32148092791,
lat: 39.967049268766
}
}] })
}],
changePosition: function changePosition(point, index) {
console.log(point, index);
}
})
);
}
}]);
Expand Down
6 changes: 5 additions & 1 deletion docs/examples/components/point-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ export default class App extends Component {
lat: 39.967049268766
}
}
]}/>
]}
changePosition={(point, index) => {
console.log(point, index);
}}
/>
</Map>
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-bmap",
"version": "1.0.53",
"version": "1.0.54",
"description": "react-bmap",
"main": "lib/index.js",
"contributors": [
Expand Down
3 changes: 3 additions & 0 deletions src/components/point-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ export default class App extends Component {
this.props.data.forEach((item, index) => {
var tip = new DraggingTip({
isShowTipArrow: true,
changePosition: (point) => {
this.props.changePosition && this.props.changePosition(point, index);
},
map: map,
numberDirection: item.numberDirection,
isShowNumber: item.isShowNumber,
Expand Down
3 changes: 3 additions & 0 deletions src/overlay/DraggingTip.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ function DraggingTip(options) {
tip.setPosition(marker.point)
options.change && options.change();
});
marker.addEventListener('dragend', function () {
options.changePosition && options.changePosition(self.point);
});
marker.enableDragging();
}

Expand Down

0 comments on commit b98a719

Please sign in to comment.