Skip to content

Commit

Permalink
fix(*): bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ctank committed May 25, 2019
1 parent b8cb1a1 commit 0dfd0d2
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dist/js/bpd-core.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/bpd-core.umd.js

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions src/draw/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ class Draw extends Operation {
this.init()
}
init() {
if (!this.options.readonly) {
this.$container
.off('mousemove.operate')
.on('mousemove.operate', this.move.bind(this))
}
this.$container
.off('mousemove.operate')
.on('mousemove.operate', this.move.bind(this))

// 创建图形
eventBus.on('shape.create', this.createShapeData.bind(this))
// 渲染图形
Expand Down Expand Up @@ -191,7 +190,7 @@ class Draw extends Operation {
left = 0
}

$layout.offset({ top, left })
$layout.css({ top, left })
}
/**
* 渲染页面
Expand Down
2 changes: 1 addition & 1 deletion src/draw/operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Operation {
$container
)

if (shapeData != null) {
if (shapeData != null && !this.options.readonly) {
eventBus.trigger('hand.destroy')

data.element = shapeData.element
Expand Down
4 changes: 2 additions & 2 deletions src/features/hand/hand.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Hand {
.off('touchstart.hand mousedown.hand')
.on('touchstart.hand mousedown.hand', e => {
const $layout = this.$container.find('.bpd-layout')
const layoutPos = $layout.offset()
const layoutPos = $layout.position()
const mousePos = {
x: 0,
y: 0
Expand Down Expand Up @@ -75,7 +75,7 @@ class Hand {
left = -pageStyle.width + window.innerWidth
}

$layout.offset({ top, left })
$layout.css({ top, left })
}
})
}
Expand Down
12 changes: 7 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,13 @@ class BPDCore {
* 激活选择模式
*/
activateSelect() {
eventBus.trigger('hand.destroy')
eventBus.trigger('shape.multiSelect', {
state: this.draw.state
})
this.draw.changeState('multiSelect')
if (!this.options.readonly) {
eventBus.trigger('hand.destroy')
eventBus.trigger('shape.multiSelect', {
state: this.draw.state
})
this.draw.changeState('multiSelect')
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</head>

<body>
<div id="canvas"></div>
<div id="canvas" style="margin: 50px"></div>

<span class="createNode-box1">
<button class="createNode" draggable="true" shapeName="startEvent">
Expand Down

0 comments on commit 0dfd0d2

Please sign in to comment.