मैं काइनेटिकज हिट क्षेत्र का उपयोग करता हूं जैसे कि इसमें आबादी थी: http://www.html5canvastutorials.com/kineticjs/html5-canvas-pixel-detection-with-kineticjs/
मेरी छवि में एक स्ट्रोक है:
var lion = new Kinetic.Image({
image: images.lion,
x: 280,
y: 30,
stroke: "red"
});
छवि में एक स्ट्रोक होता है जब हिट क्षेत्रों का उपयोग नहीं किया जाता है लेकिन जब मैं निम्नलिखित का उपयोग करता हूं तो मुझे कोई स्ट्रोक नहीं दिखाई देता।
// in order to ignore transparent pixels in an image when detecting
// events, we first need to cache the image
lion.cache();
// next, we need to redraw the hit graph using the cached image
lion.drawHitFromCache();
// finally, we need to redraw the layer hit graph
layer.drawHit();
जब मैं हिट क्षेत्रों का उपयोग करता हूं तो मुझे एक छवि के लिए दिखाई देने वाला स्ट्रोक कैसे मिल सकता है?
उत्तर:
जवाब के लिए 0 № 1यदि आप चाहते हैं कि बाउंडिंग बॉक्स को स्ट्रैक्ड किया जाए तो आप ड्रॉ बॉर्डर प्रॉपर्टी को सही पर सेट कर सकते हैं:
lion.cache({
drawBorder: true
});
चीयर्स!