|
@@ -104,6 +104,7 @@ export default class ComboBox extends Base {
|
|
|
annotationContainer.style.width = rect.width + 'px'
|
|
|
annotationContainer.style.height = rect.height + 'px'
|
|
|
annotationContainer.style.backgroundColor = this.highlight ? '#4982E54D' : ''
|
|
|
+ annotationContainer.style.overflow = 'hidden'
|
|
|
this.annotationContainer = annotationContainer
|
|
|
this.annotationContainer.addEventListener('mousedown', this.handleClick.bind(this))
|
|
|
|
|
@@ -131,8 +132,8 @@ export default class ComboBox extends Base {
|
|
|
left: 0,
|
|
|
top: 0,
|
|
|
paddingLeft: '4px',
|
|
|
- width: `${Math.abs(rect.width)}px`,
|
|
|
- height: `${Math.abs(rect.height)}px`,
|
|
|
+ width: '100%',
|
|
|
+ height: '100%',
|
|
|
borderColor: annotation.borderColor,
|
|
|
borderWidth: (annotation.borderWidth || 1) + 'px',
|
|
|
borderStyle: annotation.borderStyle || 'solid',
|
|
@@ -755,6 +756,7 @@ export default class ComboBox extends Base {
|
|
|
right: end.x,
|
|
|
bottom: end.y
|
|
|
}
|
|
|
+ this.rect = rect
|
|
|
|
|
|
this.eventBus.dispatch('annotationChange', {
|
|
|
type: 'modify',
|
|
@@ -767,7 +769,7 @@ export default class ComboBox extends Base {
|
|
|
rect
|
|
|
}
|
|
|
})
|
|
|
- this.getImage()
|
|
|
+ this.getImage(true)
|
|
|
}
|
|
|
|
|
|
update ({ start, end }) {
|
|
@@ -784,12 +786,6 @@ export default class ComboBox extends Base {
|
|
|
this.annotationContainer.style.width = `${rect.width}px`;
|
|
|
this.annotationContainer.style.height = `${rect.height}px`;
|
|
|
|
|
|
- this.shapeElement.style.width = `${rect.width}px`;
|
|
|
- this.shapeElement.style.height = `${rect.height}px`;
|
|
|
-
|
|
|
- this.selectElement.style.width = `${rect.width}px`;
|
|
|
- this.selectElement.style.height = `${rect.height}px`;
|
|
|
-
|
|
|
this.outerLine.style.left = `${rect.left - 8}px`
|
|
|
this.outerLine.style.top = `${rect.top - 8}px`
|
|
|
this.outerLine.style.width = `${rect.width + 8 * 2}px`
|
|
@@ -1096,7 +1092,7 @@ export default class ComboBox extends Base {
|
|
|
this.annotationContainer.style.backgroundColor = this.highlight ? '#4982E54D' : ''
|
|
|
}
|
|
|
|
|
|
- async getImage() {
|
|
|
+ async getImage(update) {
|
|
|
const rect = this.initRect
|
|
|
const imgRect = {
|
|
|
width: parseInt(rect.width * this.layer.ratio + 1),
|
|
@@ -1105,7 +1101,7 @@ export default class ComboBox extends Base {
|
|
|
|
|
|
const imageArray = await this.messageHandler.sendWithPromise('GetRenderAnnot', {
|
|
|
annotPtr: this.annotation.annotPtr,
|
|
|
- rect: this.annotation.rect,
|
|
|
+ rect: this.rect || this.annotation.rect,
|
|
|
scale: this.scale * this.layer.ratio
|
|
|
})
|
|
|
|
|
@@ -1121,6 +1117,12 @@ export default class ComboBox extends Base {
|
|
|
drawContext.putImageData(imageData, 0, 0)
|
|
|
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) {
|
|
|
this.imgEle.src = imgSrc
|
|
|
} else {
|