Skip to content

Commit

Permalink
release 3.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
100pah committed Apr 26, 2017
1 parent 3de9fc0 commit 0434d55
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 11 deletions.
53 changes: 49 additions & 4 deletions build/zrender.js
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,50 @@ define('zrender/core/util',['require'],function(require) {
return obj[primitiveKey];
}

/**
* @constructor
*/
function HashMap(obj) {
obj && extend(this, obj);
}

// Add prefix to avoid conflict with Object.prototype.
var HASH_MAP_PREFIX = '_ec_';
var HASH_MAP_PREFIX_LENGTH = 4;

HashMap.prototype = {
constructor: HashMap,
// Do not provide `has` method to avoid defining what is `has`.
// (We usually treat `null` and `undefined` as the same, different
// from ES6 Map).
get: function (key) {
return this[HASH_MAP_PREFIX + key];
},
set: function (key, value) {
this[HASH_MAP_PREFIX + key] = value;
// Comparing with invocation chaining, `return value` is more commonly
// used in this case: `var someVal = map.set('a', genVal());`
return value;
},
// Although util.each can be performed on this hashMap directly, user
// should not use the exposed keys, who are prefixed.
each: function (cb, context) {
context !== void 0 && (cb = bind(cb, context));
for (var prefixedKey in this) {
this.hasOwnProperty(prefixedKey)
&& cb(this[prefixedKey], prefixedKey.slice(HASH_MAP_PREFIX_LENGTH));
}
},
// Do not use this method if performance sensitive.
removeKey: function (key) {
delete this[key];
}
};

function createHashMap() {
return new HashMap();
}

var util = {
inherits: inherits,
mixin: mixin,
Expand Down Expand Up @@ -682,6 +726,7 @@ define('zrender/core/util',['require'],function(require) {
retrieve: retrieve,
assert: assert,
setAsPrimitive: setAsPrimitive,
createHashMap: createHashMap,
noop: function () {}
};
return util;
Expand Down Expand Up @@ -7597,7 +7642,7 @@ define('zrender/contain/text',['require','../core/util','../core/BoundingRect'],
break;
case 'insideTop':
x += width / 2;
y += distance;
y += distance + lineHeight;
textAlign = 'center';
break;
case 'insideBottom':
Expand All @@ -7607,12 +7652,12 @@ define('zrender/contain/text',['require','../core/util','../core/BoundingRect'],
break;
case 'insideTopLeft':
x += distance;
y += distance;
y += distance + lineHeight;
textAlign = 'left';
break;
case 'insideTopRight':
x += width - distance;
y += distance;
y += distance + lineHeight;
textAlign = 'right';
break;
case 'insideBottomLeft':
Expand Down Expand Up @@ -9441,7 +9486,7 @@ define('zrender/zrender',['require','./core/guid','./core/env','./core/util','./
/**
* @type {string}
*/
zrender.version = '3.4.3';
zrender.version = '3.4.4';

/**
* Initializing a zrender instance
Expand Down
9 changes: 4 additions & 5 deletions build/zrender.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zrender",
"version": "3.4.3",
"version": "3.4.4",
"description": "A lightweight canvas library.",
"keywords": [
"canvas",
Expand Down
2 changes: 1 addition & 1 deletion src/zrender.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ define(function(require) {
/**
* @type {string}
*/
zrender.version = '3.4.3';
zrender.version = '3.4.4';

/**
* Initializing a zrender instance
Expand Down

0 comments on commit 0434d55

Please sign in to comment.