Skip to content

Commit

Permalink
[de] Fix an active content control button state when updating UI
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillovIlya committed Feb 11, 2025
1 parent b7bf173 commit a121704
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions word/Drawing/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@
this.ContentControlObjectsLast = [];
this.ContentControlObjectState = -1;
this.ContentControlSmallChangesCheck = { X: 0, Y: 0, Page: 0, Min: 2, IsSmall : true };
this.lastActive = false;
this.lastActive = null;
this.lastHover = null;

this.measures = {};
Expand Down Expand Up @@ -2417,17 +2417,17 @@
// We might have many Track.In and just one Track.Hover
// Check last active Track.In

this.lastActive = false;
this.lastActive = null;
this.lastHover = null;

for (let i = 0; i < this.ContentControlObjects.length; ++i)
{
let ccTrack = this.ContentControlObjects[i];
if (AscCommon.ContentControlTrack.In === ccTrack.state && -2 !== ccTrack.ActiveButtonIndex)
this.lastActive = true;
this.lastActive = ccTrack;

if (AscCommon.ContentControlTrack.Hover === ccTrack.state)
this.lastHover = ccTrack
this.lastHover = ccTrack;
}

this.ContentControlObjects.length = 0;
Expand All @@ -2437,24 +2437,22 @@
if (!geom || (Array.isArray(geom) && geom.length === 0))
return;

this.ContentControlObjects.push(new CContentControlTrack(this, obj, AscCommon.ContentControlTrack.In, geom));
if (this.lastActive && this.lastActive.base && obj && this.lastActive.base.GetId() === obj.GetId())
{
this.lastActive.UpdateGeom(geom);
this.ContentControlObjects.push(this.lastActive);
}
else
{
this.ContentControlObjects.push(new CContentControlTrack(this, obj, AscCommon.ContentControlTrack.In, geom));
}

};
this.endCollectTracks = function()
{
if (this.lastActive)
{
let isActive = false;
for (let i = 0; i < this.ContentControlObjects.length; ++i)
{
let ccTrack = this.ContentControlObjects[i];
if (AscCommon.ContentControlTrack.In === ccTrack.state && -2 !== ccTrack.ActiveButtonIndex)
{
isActive = true;
break;
}
}

if (!isActive)
if (-1 === this.ContentControlObjects.indexOf(this.lastActive))
this.document.m_oWordControl.m_oApi.sendEvent("asc_onHideContentControlsActions");
}

Expand Down

0 comments on commit a121704

Please sign in to comment.