Branch: refs/heads/unstable
  Home:   https://github.com/cytoscape/cytoscape.js
  Commit: de1d23101676a9f80f9fd24fd74348e5eba1cfc5
      
https://github.com/cytoscape/cytoscape.js/commit/de1d23101676a9f80f9fd24fd74348e5eba1cfc5
  Author: Max Franz <[email protected]>
  Date:   2019-04-12 (Fri, 12 Apr 2019)

  Changed paths:
    M src/style/apply.js
    M src/style/properties.js

  Log Message:
  -----------
  Apply a special style hash value to `width` and `height`

The `width` and `height` properties can take on special `label` enum values to 
make a node the same size as its label.  The label size is not available to 
style hashing, because the styler must run before the renderer can use the 
currently applied style to calculate rendered values (e.g. the dimensions of 
text, the intersections for edges).  So the final value can not be used for 
hashing.

Instead, we use an optional, per-property hash override.  When a style property 
has a hash override function, it is the responsibility of that function to 
handle special cases (e.g. string enum values for normally numeric properties) 
and return an integer hash value.  In the case of `width` and `height`, an 
integer that uniquely corresponds to the element can be used.  This isn't 
ideal, as it means all nodes that use `width: label` or `height: label` will 
never have a shared element texture cache.  In practice, however, the overall 
likelihood of such a node having a multiple-node cache hit is small anyway.

The number hashing is also updated to take into consideration unit values, 
unless the value is normalised.  For example, a value of `75%` would otherwise 
collide with a value of `75px`.  This is the same type of problem as with the 
`label` value case, albeit less frequent.

Ref : Style hash collisions for `width:label` or `height:label` #2348


-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/cytoscape-cvs.
For more options, visit https://groups.google.com/d/optout.

Reply via email to