Skip to content

Commit

Permalink
dia.CellView: use util.result for presentationAttributes and initFlag (
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorgewilliams authored Aug 18, 2021
1 parent 19244ca commit 0461ff6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/dia/CellView.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
isEmpty,
isString,
toKebabCase,
result,
sortedIndex,
merge,
uniq
Expand Down Expand Up @@ -66,7 +67,7 @@ export const CellView = View.extend({
var attributes = {};
var shift = 0;
var i, n, label;
var presentationAttributes = this.presentationAttributes;
var presentationAttributes = result(this, 'presentationAttributes');
for (var attribute in presentationAttributes) {
if (!presentationAttributes.hasOwnProperty(attribute)) continue;
var labels = presentationAttributes[attribute];
Expand All @@ -80,7 +81,7 @@ export const CellView = View.extend({
attributes[attribute] |= flag;
}
}
var initFlag = this.initFlag;
var initFlag = result(this, 'initFlag');
if (!Array.isArray(initFlag)) initFlag = [initFlag];
for (i = 0, n = initFlag.length; i < n; i++) {
label = initFlag[i];
Expand Down Expand Up @@ -1112,7 +1113,7 @@ export const CellView = View.extend({
Highlighting: HighlightingTypes,

addPresentationAttributes: function(presentationAttributes) {
return merge({}, this.prototype.presentationAttributes, presentationAttributes, function(a, b) {
return merge({}, result(this.prototype, 'presentationAttributes'), presentationAttributes, function(a, b) {
if (!a || !b) return;
if (typeof a === 'string') a = [a];
if (typeof b === 'string') b = [b];
Expand Down
3 changes: 2 additions & 1 deletion src/dia/Paper.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
isString,
normalizeEvent,
omit,
result,
merge,
camelCase,
cloneDeep,
Expand Down Expand Up @@ -1450,7 +1451,7 @@ export const Paper = View.extend({
} else {
view = views[cell.id] = this.createViewForModel(cell);
view.paper = this;
flag = this.registerUnmountedView(view) | view.getFlag(view.initFlag);
flag = this.registerUnmountedView(view) | view.getFlag(result(view, 'initFlag'));
}
this.requestViewUpdate(view, flag, view.UPDATE_PRIORITY, opt);
return view;
Expand Down

0 comments on commit 0461ff6

Please sign in to comment.