Example #1
0
synfig::Layer::Handle
Layer_PasteCanvas::hit_check(synfig::Context context, const synfig::Point &pos)const
{
    if(depth==MAX_DEPTH)return 0;
    depth_counter counter(depth);

    Transformation transformation(get_summary_transformation());

    bool children_lock=param_children_lock.get(bool(true));
    ContextParams cp(context.get_params());
    apply_z_range_to_params(cp);
    if (canvas) {
        Point target_pos = transformation.back_transform(pos);

        if(canvas && get_amount() && canvas->get_context(cp).get_color(target_pos).get_a()>=0.25)
        {
            if(!children_lock)
            {
                return canvas->get_context(cp).hit_check(target_pos);
            }
            return const_cast<Layer_PasteCanvas*>(this);
        }
    }
    return context.hit_check(pos);
}
Example #2
0
synfig::Layer::Handle
Layer_PasteCanvas::hit_check(synfig::Context context, const synfig::Point &pos)const
{
	if(depth==MAX_DEPTH)return 0;depth_counter counter(depth);

	Vector origin=param_origin.get(Vector());
	Vector focus=param_focus.get(Vector());
	Real zoom=param_zoom.get(Real());
	bool children_lock=param_children_lock.get(bool(true));
	ContextParams cp(context.get_params());
	cp.z_range=param_z_range.get(bool());
	cp.z_range_position=param_z_range_position.get(Real());
	cp.z_range_depth=param_z_range_depth.get(Real());
	cp.z_range_blur=param_z_range_blur.get(Real());
	if (canvas) {
		Point target_pos=(pos-focus-origin)/exp(zoom)+focus;

		if(canvas && get_amount() && canvas->get_context(cp).get_color(target_pos).get_a()>=0.25)
		{
			if(!children_lock)
			{
				return canvas->get_context(cp).hit_check(target_pos);
			}
			return const_cast<Layer_PasteCanvas*>(this);
		}
	}
	return context.hit_check(pos);
}