Skip to content

Commit 2e9c2f7

Browse files
committed
Hide scaling handles of shapes when text cursor is visible.
Issue: * Open an Impress file and start editing a textbox. * See that handles are visible. * Try to re-scale the selected shape. * It doesn't work but the preview is shown. * When text editing is active, scaling is not enabled. * We need to hide the handles in that case. Signed-off-by: Gökay Şatır <[email protected]> Change-Id: I0ebf20270fc08f8553c1985456836711369407e4
1 parent 0826112 commit 2e9c2f7

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

browser/src/canvas/sections/ShapeHandleRotationSubSection.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ class ShapeHandleRotationSubSection extends CanvasSectionObject {
3030
this.sectionProperties.mapPane = (<HTMLElement>(document.querySelectorAll('.leaflet-map-pane')[0]));
3131
this.sectionProperties.previousCursorStyle = null;
3232
this.sectionProperties.cursorStyle = 'pointer';
33+
34+
app.events.on('TextCursorVisibility', this.onTextCursorVisibility.bind(this));
35+
}
36+
37+
onTextCursorVisibility(event: any): void {
38+
if (event.detail.visible) {
39+
this.setShowSection(false);
40+
this.interactable = false;
41+
}
42+
else {
43+
this.setShowSection(true);
44+
this.interactable = true;
45+
}
3346
}
3447

3548
calculateAngle(center: cool.SimplePoint, target: cool.SimplePoint): number {

browser/src/canvas/sections/ShapeHandleScalingSubSection.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,25 @@ class ShapeHandleScalingSubSection extends CanvasSectionObject {
3737
this.sectionProperties.mapPane = (<HTMLElement>(document.querySelectorAll('.leaflet-map-pane')[0]));
3838

3939
this.setMousePointerType();
40+
41+
app.events.on('TextCursorVisibility', this.onTextCursorVisibility.bind(this));
4042
}
4143

4244
onInitialize(): void {
4345
this.setPosition(this.sectionProperties.position.pX, this.sectionProperties.position.pY);
4446
}
4547

48+
onTextCursorVisibility(event: any): void {
49+
if (event.detail.visible) {
50+
this.setShowSection(false);
51+
this.interactable = false;
52+
}
53+
else {
54+
this.setShowSection(true);
55+
this.interactable = true;
56+
}
57+
}
58+
4659
onDraw(frameCount?: number, elapsedTime?: number, subsetBounds?: cool.Bounds): void {
4760
this.context.fillStyle = 'wheat';
4861
this.context.strokeStyle = 'black';

browser/src/layer/tile/CanvasTileLayer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,6 +1959,7 @@ L.CanvasTileLayer = L.Layer.extend({
19591959
app.file.textCursor.visible = command ? true : false;
19601960
this._removeSelection();
19611961
this._onUpdateCursor();
1962+
app.events.fire('TextCursorVisibility', { visible: app.file.textCursor.visible });
19621963
},
19631964

19641965
_setCursorVisible: function() {

0 commit comments

Comments
 (0)