|
@@ -83,6 +83,7 @@ export default class RadioButton extends Base {
|
|
annotationContainer.style.width = rect.width + 'px'
|
|
annotationContainer.style.width = rect.width + 'px'
|
|
annotationContainer.style.height = rect.height + 'px'
|
|
annotationContainer.style.height = rect.height + 'px'
|
|
annotationContainer.style.backgroundColor = this.highlight ? '#4982E54D' : ''
|
|
annotationContainer.style.backgroundColor = this.highlight ? '#4982E54D' : ''
|
|
|
|
+ annotationContainer.style.overflow = 'hidden'
|
|
this.annotationContainer = annotationContainer
|
|
this.annotationContainer = annotationContainer
|
|
this.annotationContainer.addEventListener('mousedown', this.handleClick.bind(this))
|
|
this.annotationContainer.addEventListener('mousedown', this.handleClick.bind(this))
|
|
|
|
|
|
@@ -113,8 +114,8 @@ export default class RadioButton extends Base {
|
|
display: 'flex',
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
justifyContent: 'center',
|
|
- width: `${Math.abs(rect.width)}px`,
|
|
|
|
- height: `${Math.abs(rect.height)}px`,
|
|
|
|
|
|
+ width: '100%',
|
|
|
|
+ height: '100%',
|
|
borderColor: annotation.borderColor,
|
|
borderColor: annotation.borderColor,
|
|
borderWidth: annotation.borderWidth | 1 + 'px',
|
|
borderWidth: annotation.borderWidth | 1 + 'px',
|
|
borderStyle: annotation.borderStyle,
|
|
borderStyle: annotation.borderStyle,
|
|
@@ -782,6 +783,7 @@ export default class RadioButton extends Base {
|
|
right: end.x,
|
|
right: end.x,
|
|
bottom: end.y
|
|
bottom: end.y
|
|
}
|
|
}
|
|
|
|
+ this.rect = rect
|
|
|
|
|
|
this.eventBus.dispatch('annotationChange', {
|
|
this.eventBus.dispatch('annotationChange', {
|
|
type: 'modify',
|
|
type: 'modify',
|
|
@@ -794,7 +796,7 @@ export default class RadioButton extends Base {
|
|
rect
|
|
rect
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- this.getImage()
|
|
|
|
|
|
+ this.getImage(true)
|
|
}
|
|
}
|
|
|
|
|
|
update ({ start, end }) {
|
|
update ({ start, end }) {
|
|
@@ -811,9 +813,6 @@ export default class RadioButton extends Base {
|
|
this.annotationContainer.style.width = `${rect.width}px`;
|
|
this.annotationContainer.style.width = `${rect.width}px`;
|
|
this.annotationContainer.style.height = `${rect.height}px`;
|
|
this.annotationContainer.style.height = `${rect.height}px`;
|
|
|
|
|
|
- this.borderElement.style.width = `${rect.width}px`;
|
|
|
|
- this.borderElement.style.height = `${rect.height}px`;
|
|
|
|
-
|
|
|
|
this.outerLine.style.left = `${rect.left - 4}px`
|
|
this.outerLine.style.left = `${rect.left - 4}px`
|
|
this.outerLine.style.top = `${rect.top - 4}px`
|
|
this.outerLine.style.top = `${rect.top - 4}px`
|
|
this.outerLine.style.width = `${rect.width + 4 * 2}px`
|
|
this.outerLine.style.width = `${rect.width + 4 * 2}px`
|
|
@@ -1017,7 +1016,7 @@ export default class RadioButton extends Base {
|
|
this.annotationContainer.style.backgroundColor = this.highlight ? '#4982E54D' : ''
|
|
this.annotationContainer.style.backgroundColor = this.highlight ? '#4982E54D' : ''
|
|
}
|
|
}
|
|
|
|
|
|
- async getImage() {
|
|
|
|
|
|
+ async getImage(update) {
|
|
const rect = this.initRect
|
|
const rect = this.initRect
|
|
const imgRect = {
|
|
const imgRect = {
|
|
width: parseInt(rect.width * this.layer.ratio + 1),
|
|
width: parseInt(rect.width * this.layer.ratio + 1),
|
|
@@ -1026,7 +1025,7 @@ export default class RadioButton extends Base {
|
|
|
|
|
|
const imageArray = await this.messageHandler.sendWithPromise('GetRenderAnnot', {
|
|
const imageArray = await this.messageHandler.sendWithPromise('GetRenderAnnot', {
|
|
annotPtr: this.annotation.annotPtr,
|
|
annotPtr: this.annotation.annotPtr,
|
|
- rect: this.annotation.rect,
|
|
|
|
|
|
+ rect: this.rect || this.annotation.rect,
|
|
scale: this.scale * this.layer.ratio
|
|
scale: this.scale * this.layer.ratio
|
|
})
|
|
})
|
|
|
|
|
|
@@ -1042,6 +1041,12 @@ export default class RadioButton extends Base {
|
|
drawContext.putImageData(imageData, 0, 0)
|
|
drawContext.putImageData(imageData, 0, 0)
|
|
const imgSrc = canvas.toDataURL("image/png", 1)
|
|
const imgSrc = canvas.toDataURL("image/png", 1)
|
|
|
|
|
|
|
|
+ if (update) {
|
|
|
|
+ const rect = this.calculate(this.start, this.end)
|
|
|
|
+ this.shapeElement.style.width = `${rect.width}px`
|
|
|
|
+ this.shapeElement.style.height = `${rect.height}px`
|
|
|
|
+ }
|
|
|
|
+
|
|
if (this.imgEle) {
|
|
if (this.imgEle) {
|
|
this.imgEle.src = imgSrc
|
|
this.imgEle.src = imgSrc
|
|
} else {
|
|
} else {
|