@breakside/jskit 2022.22.0 → 2022.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Frameworks/DOM.jsframework/Info.json +2 -2
- package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/DOM.jsframework/sources.json +10 -3
- package/Frameworks/FontKit.jsframework/Info.json +2 -2
- package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/FontKit.jsframework/sources.json +34 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSAttributedString.js +69 -20
- package/Frameworks/Foundation.jsframework/JS/JSTextAttachment.js +6 -1
- package/Frameworks/Foundation.jsframework/JS/JSTextRun.js +3 -0
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/sources.json +159 -1
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Frameworks/SecurityKit.jsframework/sources.json +43 -2
- package/Info.json +2 -2
- package/Node/Builder.js +20 -9
- package/Node/FrameworkBuilder.js +22 -2
- package/Node/Project.js +22 -2
- package/Node/io.breakside.jskit-bundle.js +2 -2
- package/Root/Frameworks/APIKit/Info.yaml +1 -1
- package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/Info.yaml +1 -1
- package/Root/Frameworks/CSSOM/Info.yaml +1 -1
- package/Root/Frameworks/ChartKit/Info.yaml +1 -1
- package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
- package/Root/Frameworks/DBKit/Info.yaml +1 -1
- package/Root/Frameworks/DOM/Info.yaml +1 -1
- package/Root/Frameworks/Dispatch/Info.yaml +1 -1
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSAttributedString.js +69 -20
- package/Root/Frameworks/Foundation/JSTextAttachment.js +6 -1
- package/Root/Frameworks/Foundation/JSTextRun.js +3 -0
- package/Root/Frameworks/ImageKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
- package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
- package/Root/Frameworks/PDFKit/Info.yaml +1 -1
- package/Root/Frameworks/QRKit/Info.yaml +1 -1
- package/Root/Frameworks/SearchKit/Info.yaml +1 -1
- package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/UICollectionView.js +11 -7
- package/Root/Frameworks/UIKit/UIContainerView.js +1 -1
- package/Root/Frameworks/UIKit/UIHTMLTextFrame.js +3 -0
- package/Root/Frameworks/UIKit/UIHTMLTextRun.js +3 -1
- package/Root/Frameworks/UIKit/UIHTMLTextTypesetter.js +14 -0
- package/Root/Frameworks/UIKit/UIImageView.js +4 -0
- package/Root/Frameworks/UIKit/UILabel.js +43 -10
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -174,11 +174,14 @@ JSClass('UILabel', UIView, {
|
|
|
174
174
|
var attributes = this.attributedText.attributesAtIndex(index);
|
|
175
175
|
this._didDrag = false;
|
|
176
176
|
if (attributes.link){
|
|
177
|
-
var range = this.attributedText.
|
|
178
|
-
var layer =
|
|
179
|
-
layer.
|
|
180
|
-
|
|
181
|
-
|
|
177
|
+
var range = this.attributedText.longestRangeOfAttributeAtIndex("link", index);
|
|
178
|
+
var layer = UILabelLinkLayer.init();
|
|
179
|
+
layer.pathColor = (attributes.textColor || this.textColor).colorWithAlpha(0.2);
|
|
180
|
+
var rects = this.layer.textLayoutManager.rectsForCharacterRange(range);
|
|
181
|
+
var i, l;
|
|
182
|
+
for (i = 0, l = rects.length; i < l; ++i){
|
|
183
|
+
layer.addRect(rects[i]);
|
|
184
|
+
}
|
|
182
185
|
this.layer.addSublayer(layer);
|
|
183
186
|
this._mouseDownAction = {
|
|
184
187
|
link: attributes.link,
|
|
@@ -271,11 +274,14 @@ JSClass('UILabel', UIView, {
|
|
|
271
274
|
var index = this.layer.textLayoutManager.characterIndexAtPoint(location);
|
|
272
275
|
var attributes = this.attributedText.attributesAtIndex(index);
|
|
273
276
|
if (attributes.link){
|
|
274
|
-
var range = this.attributedText.
|
|
275
|
-
var layer =
|
|
276
|
-
layer.
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
var range = this.attributedText.longestRangeOfAttributeAtIndex("link", index);
|
|
278
|
+
var layer = UILabelLinkLayer.init();
|
|
279
|
+
layer.pathColor = (attributes.textColor || this.textColor).colorWithAlpha(0.2);
|
|
280
|
+
var rects = this.layer.textLayoutManager.rectsForCharacterRange(range);
|
|
281
|
+
var i, l;
|
|
282
|
+
for (i = 0, l = rects.length; i < l; ++i){
|
|
283
|
+
layer.addRect(rects[i]);
|
|
284
|
+
}
|
|
279
285
|
this.layer.addSublayer(layer);
|
|
280
286
|
this._touchAction = {
|
|
281
287
|
link: attributes.link,
|
|
@@ -379,4 +385,31 @@ JSClass('UILabel', UIView, {
|
|
|
379
385
|
|
|
380
386
|
});
|
|
381
387
|
|
|
388
|
+
JSClass("UILabelLinkLayer", UILayer, {
|
|
389
|
+
|
|
390
|
+
pathColor: null,
|
|
391
|
+
|
|
392
|
+
init: function(){
|
|
393
|
+
UILabelLinkLayer.$super.init.call(this);
|
|
394
|
+
this.path = JSPath.init();
|
|
395
|
+
this.pathColor = JSColor.black;
|
|
396
|
+
this.setNeedsDisplay();
|
|
397
|
+
},
|
|
398
|
+
|
|
399
|
+
addRect: function(rect){
|
|
400
|
+
this.path.addRoundedRect(rect.rectWithInsets(JSInsets(-1, -2)), 2);
|
|
401
|
+
this.frame = this.path.boundingRect;
|
|
402
|
+
},
|
|
403
|
+
|
|
404
|
+
drawInContext: function(context){
|
|
405
|
+
context.save();
|
|
406
|
+
context.translateBy(-this.path.boundingRect.origin.x, -this.path.boundingRect.origin.y);
|
|
407
|
+
context.setFillColor(this.pathColor);
|
|
408
|
+
context.addPath(this.path);
|
|
409
|
+
context.fillPath();
|
|
410
|
+
context.restore();
|
|
411
|
+
},
|
|
412
|
+
|
|
413
|
+
});
|
|
414
|
+
|
|
382
415
|
UILabel.layerClass = UITextLayer;
|