Skip to content

Commit

Permalink
Use sublayer api instead of SubLayersInfo.js
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasstein committed Aug 23, 2022
1 parent 7fc4d8c commit b933c97
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {findInfoOfSubLayer, findSubLayerInfos } from "./SubLayersInfo";

const ID = "show-html-description";

export default class HtmlDescriptionActionDefinitionFactory {
Expand Down Expand Up @@ -42,10 +40,7 @@ export default class HtmlDescriptionActionDefinitionFactory {
isVisibleForItem(tocItem) {
const hasDescription = isValidDescription(this.valueOf(tocItem));
if (!hasDescription && tocItem.type === "sublayer") {
const infos = findSubLayerInfos(tocItem.ref);
if (infos && !infos.loaded) {
return infos.load().then(() => isValidDescription(this.valueOf(tocItem)));
}
return tocItem.ref.load?.().then(() => isValidDescription(this.valueOf(tocItem)));
}
return hasDescription;
},
Expand All @@ -56,16 +51,12 @@ export default class HtmlDescriptionActionDefinitionFactory {
return itemDescription;
}

const metadata = findInfoOfSubLayer(tocItem.ref);
if (!metadata) {
return undefined;
}
return metadata.description;
return tocItem.ref.sourceJSON?.description;
},

trigger(tocItem) {
labelWin.showText({
text: tocItem.ref.description,
text: this.valueOf(tocItem),
windowTitle: i18n.description,
windowSize: winSize
});
Expand Down
136 changes: 0 additions & 136 deletions src/main/js/bundles/dn_tocdescriptionhtml/SubLayersInfo.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/js/bundles/dn_tocdescriptionhtml/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
import ".";
import "./HtmlDescriptionActionDefinitionFactory";
import "./ActionUIFactory";
import "./HtmlTextLabelWindowSupport"
import "./HtmlTextLabelWindowSupport";

0 comments on commit b933c97

Please sign in to comment.