Skip to content

Commit

Permalink
修复在火狐下的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Foveluy committed Mar 1, 2018
1 parent 86bc00b commit 7d6f217
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/react-dragger-layout.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lib/GridItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ var GridItem = /** @class */ (function (_super) {
return;
var _b = this.calGridXY(x, y), GridX = _b.GridX, GridY = _b.GridY;
this.props.onDragStart && this.props.onDragStart({
event: event, GridX: GridX, GridY: GridY, w: w, h: h, UniqueKey: UniqueKey + ''
event: null, GridX: GridX, GridY: GridY, w: w, h: h, UniqueKey: UniqueKey + ''
});
};
GridItem.prototype.onDrag = function (event, x, y) {
Expand Down
7 changes: 6 additions & 1 deletion src/lib/dragger/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ export class Dragger extends React.Component<DraggerProps, {}> {
/** 保证用户在移动元素的时候不会选择到元素内部的东西 */
doc.body.style.userSelect = 'none'



// if (event.target.id !== 'dragact-handle') return

Expand Down Expand Up @@ -243,9 +244,11 @@ export class Dragger extends React.Component<DraggerProps, {}> {
this.self = event.currentTarget
}

this.props.onDragStart && this.props.onDragStart(this.state.x, this.state.y)


this.props.onDragStart && this.props.onDragStart(this.state.x, this.state.y)


let originX, originY;
if (event.type.indexOf('mouse') >= 0) {
originX = (event as MouseEvent).clientX
Expand All @@ -255,6 +258,8 @@ export class Dragger extends React.Component<DraggerProps, {}> {
originY = (event as TouchEvent).touches[0].clientY
}



this.setState({
originX: originX,
originY: originY,
Expand Down
5 changes: 3 additions & 2 deletions src/lib/gridItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface GridItemProps {

isUserMove: Boolean

UniqueKey?: string
UniqueKey?: string

static?: Boolean

Expand Down Expand Up @@ -163,12 +163,13 @@ export default class GridItem extends React.Component<GridItemProps, {}> {

onDragStart(x: number, y: number) {
const { w, h, UniqueKey } = this.props;

if (this.props.static) return;

const { GridX, GridY } = this.calGridXY(x, y)

this.props.onDragStart && this.props.onDragStart({
event, GridX, GridY, w, h, UniqueKey: UniqueKey + ''
event: null, GridX, GridY, w, h, UniqueKey: UniqueKey + ''
})
}
onDrag(event: any, x: number, y: number) {
Expand Down

0 comments on commit 7d6f217

Please sign in to comment.